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

Fix pytest dependency conflict #299

Closed
1 task
philherbert opened this issue Dec 21, 2020 · 0 comments
Closed
1 task

Fix pytest dependency conflict #299

philherbert opened this issue Dec 21, 2020 · 0 comments

Comments

@philherbert
Copy link

philherbert commented Dec 21, 2020

Value Statement

As a VANotify developer
I want to ensure that my dependencies are up to date
So that I can make use of new features and security patches

Acceptance Criteria

WHEN I run pip install -r requirements_for_text.txt
THEN I don't get any dependency conflicts

Checklist

  • Checklist item here

Assumptions

Additional Info/Resources

Running pip install -r requirements_for_text.txt without --use-deprecated=legacy-resolver returns the following error:

ERROR: Cannot install pytest-cov==2.6.1, pytest-env==0.6.2, pytest-flask-sqlalchemy==1.0.2, pytest-mock==3.3.1 and pytest==3.10.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested pytest==3.10.1
    pytest-cov 2.6.1 depends on pytest>=3.6
    pytest-env 0.6.2 depends on pytest>=2.6.0
    pytest-flask-sqlalchemy 1.0.2 depends on pytest>=3.2.1
    pytest-mock 3.3.1 depends on pytest>=5.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

To resolve this error, we have to upgrade pytest to 5.0. However, doing this breaks a looot of tests - for example, tests.app.service.test_rest.test_get_detailed_service:

FAILED                    [ 48%]
tests/app/service/test_rest.py:1800 (test_get_detailed_service[today])
Fixture "sample_notification" 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.

See this documentation for a description of the deprecated behaviour.

Out of Scope

Open Questions

@philherbert philherbert mentioned this issue Dec 31, 2020
2 tasks
philherbert pushed a commit that referenced this issue Dec 31, 2020
Stopped 2 fixtures from calling other fixtures as functions and causing
errors.
philherbert pushed a commit that referenced this issue Dec 31, 2020
This will be used to stop us needing to call the `sample_service_whitelist` fixture as
a function.
philherbert pushed a commit that referenced this issue Dec 31, 2020
These fixtures were both calling other fixtures as functions and being
called as functions in the tests. Rewriting the tests to make them
Pytest 4 compatible means we are no longer using
`sample_template_without_letter_permission`, so this has been deleted.
philherbert pushed a commit that referenced this issue Dec 31, 2020
Since Pytest 5, `ExceptionInfo` objects (returned by `pytest.raises`) now
have the same `str` representation as `repr`. This means that `str(e)`
now needs to be changed to `str(e.value)`.

pytest-dev/pytest#5412
philherbert pushed a commit that referenced this issue Dec 31, 2020
Stopped some the fixtures in conftest.py from calling other
fixtures as functions to make them Pytest 4 compliant.
philherbert added a commit that referenced this issue Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant