How to import custom pytestmark? (analogy with pytest_plugins) #10188
-
Hi! Please tell me how to import pytestmark with parameterization correctly? Conditionally, I can have a file: # tests_helpers/mark/some_mark.py
pytestmark = pytest.mark.parametrize("n,expected", [(1, 2), (3, 4)]) And I will make an import in my test from tests_helpers.mark.some_mark import pytestmark Yes, this will work conditionally, but the import will be highlighted in the IDE as unused. Maybe there is a mechanism for connecting your fixture to conftest? pytest_plugins = [
'tests_helpers.pytest_fixtures.unit.commands',
] |
Beta Was this translation helpful? Give feedback.
Answered by
nicoddemus
Aug 11, 2022
Replies: 1 comment 3 replies
-
Hi, Importing the mark like you did is the way to go. Most IDEs have a mechanism to make it not consider the import unused, usually by adding a comment to it. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
nicoddemus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Importing the mark like you did is the way to go. Most IDEs have a mechanism to make it not consider the import unused, usually by adding a comment to it.