-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Fix tests under pytest 4 #179
base: master
Are you sure you want to change the base?
Conversation
Pytest 4 removed support for calling fixtures directly: https://docs.pytest.org/en/latest/deprecations.html#calling-fixtures-directly This leads to an error when trying to run the tests: ``` ==================================== ERRORS ==================================== _________________ ERROR collecting tests/test_bounding_box.py __________________ Fixture "red" called directly. Fixtures are not meant to be called directly, but are created automatically when test functions request them as parameters. See https://docs.pytest.org/en/latest/fixture.html for more information about fixtures, and https://docs.pytest.org/en/latest/deprecations.html#calling-fixtures-directly about how to update your code. ```
The test failure looks irrelevant. |
It seems to be caused by Ref: pypa/setuptools#1257 |
Thank you! Works for on openSUSE/Tumbleweed (and it is a part of the official package now). |
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.
I think it's better to do this
@@ -8,7 +8,6 @@ | |||
from redbaron import RedBaron | |||
|
|||
|
|||
@pytest.fixture | |||
def red(): |
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.
def red(): | |
@pytest.fixture | |
def red(): | |
"""Create an FST object for testing.""" | |
return construct_fst() | |
def construct_fst() | |
"""Return an FST object.""" |
def red_fixture(): | ||
return red() | ||
|
||
|
||
fst = red() |
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.
fst = red() | |
fst = construct_fst() |
Pytest 4 removed support for calling fixtures directly: https://docs.pytest.org/en/latest/deprecations.html#calling-fixtures-directly
This leads to an error when trying to run the tests: