-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite test_import.py
using pytest
#332
Conversation
7fa8a56
to
8ff4af7
Compare
os.chdir(tmp_path) | ||
repo_name1 = str(uuid.uuid4()) | ||
repo_name2 = str(uuid.uuid4()) | ||
sample_dir = Path(str(uuid.uuid4())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.chdir(tmp_path) | |
repo_name1 = str(uuid.uuid4()) | |
repo_name2 = str(uuid.uuid4()) | |
sample_dir = Path(str(uuid.uuid4())) | |
repo_name1 = str(uuid.uuid4()) | |
repo_name2 = str(uuid.uuid4()) | |
sample_dir = tmp_path / str(uuid.uuid4()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hum... if we remove the os.chdir we will also need to modify the lines that depends on the dir path, right?
For example:
subprocess.run(["ostree", f"--repo={repo_name1}", "init", "--mode=archive"])
or
subprocess.run(["tar", "-cvf", f"{repo_name1}.tar", f"{repo_name1}/"])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really, only the last change is relevant:
sample_dir = tmp_path / str(uuid.uuid4())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah,you maybe right. (You could probably also add a pwd to the subprocess call.)
8ff4af7
to
ee55313
Compare
"""A factory to generate an ostree Distribution with auto-deletion after the test run.""" | ||
|
||
def _ostree_distribution_factory(**body): | ||
data = {"base_path": str(uuid.uuid4()), "name": str(uuid.uuid4())} | ||
data.update(body) | ||
return gen_object_with_cleanup(ostree_distribution_factory, data) | ||
return gen_object_with_cleanup(ostree_distributions_api_client, data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😨
response = http_get(urljoin(ostree_repo_path, delta_path)) | ||
assert response | ||
|
||
monitor_task(ostree_distributions_api_client.delete(distribution.pulp_href).task) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added in the old test case to obliterate CI errors. I think we may want to return a distribution and repository from this function to make it possible to run these tests in parallel. The test_version_removal
test should handle the removal of the distribution on its own. It was the only place where we wanted to get rid of distribution to be able to delete a repository version.
ee55313
to
8783451
Compare
fixes: #325