Skip to content
Advertisement

Configute tox.ini to ignore library during tests with py27

I have the following tox.ini configuration file:

JavaScript

I have update my requirements.txt file in order to upgrade the version of Marshmallow from 3.0.0b14 to 3.10.0; like this:

JavaScript

Now my problem is that, when I run tox -e py37 everything works fine, but when I run this command tox -e py27, it fails. I get that the issue is that Marshmallow 3.10.0 is not supported on Python 2.7; so what I want to do is to change the tox.ini file in order to ignore Marshmallow library tests when it comes to running this command tox -e py27. I am new with tox, so I am not sure how to do this. Any help is welcome, thanks.

Advertisement

Answer

You need to mark those “Marshmellow” tests with a pytest marker.

https://docs.pytest.org/en/6.2.x/example/markers.html

e.g.

JavaScript

And then you need to run pytest -m "not marshmellow".

As you only want to do this for Python 2.7, you’d need to create a new testenv.

e.g.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement