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

generate fixture for PostGenerationMethodCall declaration #103

Merged
merged 11 commits into from
May 13, 2022

Conversation

skarzi
Copy link
Contributor

@skarzi skarzi commented Dec 22, 2020

Closes #87

This PR adds fixtures generation for all subclasses (except RelatedFactory) of PostGenerationDeclaration.
The fixture is generated from attr_fixture and it's simply passed as a context.value to declaration's call() method call, so it will be available for:

  • PostGeneration in function as extracted
  • PostGenerationMethodCall as first argument of called method

This change is Reviewable

@skarzi
Copy link
Contributor Author

skarzi commented Jan 12, 2021

@youtux I will be very grateful if you find some time to review this PR because such a change will make working with the PostGenerationMethodCall declaration much easier

assert foo._create is True


@pytest.mark.parametrize("foo__set2", [123])
def test_postgeneration_fixture(foo):
"""Test fixture for ``PosGeneration`` declaration."""
Copy link

Choose a reason for hiding this comment

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

typo PostGeneration

Copy link

Choose a reason for hiding this comment

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

also below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for a review ;)

@youtux youtux requested a review from olegpidsadnyi June 27, 2021 07:44
Copy link
Contributor

@olegpidsadnyi olegpidsadnyi left a comment

Choose a reason for hiding this comment

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

looks ok to me

@skarzi
Copy link
Contributor Author

skarzi commented Nov 3, 2021

hi 👋

could you prepare a new release with this feature included?
Of course, I can help if something else should be done/implemented before the new release

@skarzi
Copy link
Contributor Author

skarzi commented May 11, 2022

@youtux could you please review this PR?

Comment on lines +160 to +165
@pytest.mark.parametrize(
("foo__secret", "foo__number"),
[
("test secret", 456),
],
)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can make 2 different calls to parametrize. It should look more neat

@youtux
Copy link
Contributor

youtux commented May 11, 2022

Sorry it took so long, I didn't have it under my radar

@youtux youtux enabled auto-merge May 13, 2022 18:23
@youtux youtux merged commit 8df7312 into pytest-dev:master May 13, 2022
@skarzi skarzi deleted the issue-87 branch May 14, 2022 16:41
@skarzi
Copy link
Contributor Author

skarzi commented May 14, 2022

@youtux sorry for the delay from my side, but if you want I can add another PR with changes suggested by you

@youtux
Copy link
Contributor

youtux commented May 15, 2022

No worries, I already applied the suggestion and merged the pr. also release a new version with this fix on pypi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: can only concatenate str (not "PostGenerationMethodCall") to str
4 participants