Allow host_conf usage w/o request fixture#21484
Open
lpramuk wants to merge 1 commit into
Open
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAllow the host_conf fixture to accept a plain dict mimicking pytest’s request object so contenthost_factory can be used from unparametrized fixtures, and simplify the no-containers flag logic. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
a766569 to
4b0cfd0
Compare
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new
elif 'param' in request:branch will raise aTypeErrorwhenrequestis apytestFixtureRequestwithoutparam; consider explicitly checkingisinstance(request, dict)(or similar) before doing a membership test on it. - When supporting both dict-like and
FixtureRequestinputs inhost_conf, it may be safer to avoid accessingrequest.config/request.nodeunconditionally and instead gate those attribute accesses behind anhasattr/isinstancecheck to prevent misuse with plain dicts.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `elif 'param' in request:` branch will raise a `TypeError` when `request` is a `pytest` `FixtureRequest` without `param`; consider explicitly checking `isinstance(request, dict)` (or similar) before doing a membership test on it.
- When supporting both dict-like and `FixtureRequest` inputs in `host_conf`, it may be safer to avoid accessing `request.config` / `request.node` unconditionally and instead gate those attribute accesses behind an `hasattr`/`isinstance` check to prevent misuse with plain dicts.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
Author
|
So both way are covered by PRT |
Collaborator
|
PRT Result |
4b0cfd0 to
60a6975
Compare
Contributor
Author
|
60a6975 to
4c568c8
Compare
Contributor
Author
|
Contributor
Author
trigger: test-robottelo
pytest: >-
-v
tests/foreman/api/test_registration.py::test_host_registration_end_to_end
tests/foreman/cli/test_remoteexecution.py::TestRemoteExecution::test_positive_run_default_job_template |
Collaborator
|
PRT Result |
Collaborator
|
PRT Result |
Contributor
Author
|
1 similar comment
Contributor
Author
|
Contributor
Author
|
Contributor
Author
|
Collaborator
|
PRT Result |
Collaborator
|
PRT Result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem Statement
contenthost_factoryalways requires the fixture to be parametrized:Removing unnecessary fixture parametrization w/o removing
contenthost_factoryis not possible:^ impossible code
Solution
In
host_conf()add handling of dictionary object mimickingrequestin order to allow unparametrized fixtures to still usecontenthost_factoryRelated Issues
Summary by Sourcery
Allow content host configuration fixture to be used without a pytest request object and update external puppet server provisioning to RHEL 9 with revised test conditions.
Bug Fixes:
Enhancements:
Summary by Sourcery
Allow content host configuration to accept plain parameter dictionaries in addition to pytest request objects when used by fixtures.
Bug Fixes:
Enhancements: