Skip to content
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

Remove pulp-smash from test_pull_content #1921

Merged
merged 1 commit into from
Feb 11, 2025
Merged

Conversation

gerrod3
Copy link
Contributor

@gerrod3 gerrod3 commented Feb 6, 2025

No description provided.

@gerrod3 gerrod3 force-pushed the smash-10 branch 3 times, most recently from 775f08a to 3e7b210 Compare February 9, 2025 21:02
@gerrod3 gerrod3 marked this pull request as ready for review February 9, 2025 21:51
@gerrod3 gerrod3 enabled auto-merge (rebase) February 9, 2025 21:51
Comment on lines +209 to +205
monitor_task(
pulpcore_bindings.OrphansCleanupApi.cleanup({"orphan_protection_time": 0}).task
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have the orphan_cleanup_pre fixture for this I believe.
And it even prevents you from adding the parallel mark.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's called delete_orphans_pre, yeah?

Copy link
Contributor Author

@gerrod3 gerrod3 Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already tried, it is not allowed because of scope mismatch.

pulp_container/tests/functional/api/test_pull_content.py Outdated Show resolved Hide resolved
repo = container_repository_factory()
remote = container_remote_factory(policy="on_demand")
container_sync(repo, remote)
type(self).repo = container_bindings.RepositoriesContainerApi.read(repo.pulp_href)
Copy link
Contributor

@dralley dralley Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why type(self).repo is needed vs. just self.repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not fully sure, but I think it has to do with how the tests in a class are executed in pytest. Basically the tests don't seem to share the same state in the self object (they might not be the same object), so for a class fixture that you want to assign a state for you must put it on the class object, i.e. type(self). It's an ugly pattern so I'll remove it.



class PullOnDemandContentTestCase(unittest.TestCase):
class TestPullOnDemandContent:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not possible for TestPullContent and TestPullOnDemandContent to share some of this code instead of duplicating so much of it? It looks like much of it was copied and pasted at one point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be interpreted as a blocker to the immediate goal of dropping pulp-smash ^

@gerrod3 gerrod3 force-pushed the smash-10 branch 3 times, most recently from af7c9df to de07814 Compare February 11, 2025 19:10
dralley
dralley previously approved these changes Feb 11, 2025
Copy link
Contributor

@dralley dralley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, didn't notice the CI turned red again

@gerrod3
Copy link
Contributor Author

gerrod3 commented Feb 11, 2025

@dralley Can you reapprove, got the CI green now.

@gerrod3 gerrod3 merged commit 4fcf75b into pulp:main Feb 11, 2025
12 checks passed
@gerrod3 gerrod3 deleted the smash-10 branch February 11, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants