# Upgrade default Pytest for Python3.6 and 3.7?

**URL:** <https://travis-ci.community/t/upgrade-default-pytest-for-python3-6-and-3-7/9000>\
**Category:** Python\
**Tags:** build-env, python\
**Created:** [June 12, 2020, 10:01pm UTC](https://travis-ci.community/t/upgrade-default-pytest-for-python3-6-and-3-7/9000 "2020-06-12T22:01:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjvrijn](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/sjvrijn/32/4777_2.png) [@sjvrijn](https://travis-ci.community/u/sjvrijn)\
**Post date:** [June 12, 2020, 10:01pm UTC](https://travis-ci.community/t/upgrade-default-pytest-for-python3-6-and-3-7/9000/1 "2020-06-12T22:01:30Z")

</div>

`pytest-cov` recently updated their requirements from \>=3.6 to \>=4.6 ([see here](https://github.com/pytest-dev/pytest-cov/commit/1689c9ad514e86ba9331e36b2ab84ddcac481a44#diff-2eeaed663bd0d25b7e608891384b7298)), while the pre-installed pytest in Python3.6 and 3.7 seems to be 4.3.1 . See e.g. [Travis CI - Test and Deploy with Confidence](https://travis-ci.com/github/sjvrijn/mf2/jobs/348514594) as an example, where Python3.8 (with default pytest 5.2.1) builds just fine.

Pip doesn’t reevaluate its pytest version when `pytest` is listed before `pytest-cov` in the requirements.txt. For my repo I’ve solved the issue by adding `-U` to my `pip install -r requirements-dev.txt`line, but I probably won’t be the only one with this issue…

> Requirement already satisfied: pytest in /home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages (from -r requirements-dev.txt (line 6)) (4.3.1)  
> […]  
> pytest-cov 2.10.0 has requirement pytest\>=4.6, but you’ll have pytest 4.3.1 which is incompatible.

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [June 15, 2020, 11:53am UTC](https://travis-ci.community/t/upgrade-default-pytest-for-python3-6-and-3-7/9000/2 "2020-06-15T11:53:21Z")

</div>

If you specify a more recent version of Python, e.g., `3.6.10`, you should get a more recent archive, which has newer tools.

> **[Travis CI Documentation](https://docs.travis-ci.com/user/languages/python/#python-versions)**
>
> Building a Python Project

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [June 18, 2020, 12:23pm UTC](https://travis-ci.community/t/upgrade-default-pytest-for-python3-6-and-3-7/9000/3 "2020-06-18T12:23:32Z")

</div>

2 posts were split to a new topic: [Provide a way to install the most recent Python version in a release line](https://travis-ci.community/t/provide-a-way-to-install-the-most-recent-python-version-in-a-release-line/9050)

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [June 18, 2020, 12:18pm UTC](https://travis-ci.community/t/upgrade-default-pytest-for-python3-6-and-3-7/9000/5 "2020-06-18T12:18:46Z")

</div>

> [@sjvrijn](#):
>
> Pip doesn’t reevaluate its pytest version when `pytest` is listed before `pytest-cov` in the requirements.txt

Why not specify it after then as a workaround?

This looks like a problem of Pip as it doesn’t calculate the versions to install correctly. This may be addressed in Pip’s new resolver: [Python Software Foundation News: New pip resolver to roll out this year](http://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html)

---

<div class="post-metadata">

**Author:** ![sjvrijn](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/sjvrijn/32/4777_2.png) [@sjvrijn](https://travis-ci.community/u/sjvrijn)\
**Post date:** [June 19, 2020, 10:06am UTC](https://travis-ci.community/t/upgrade-default-pytest-for-python3-6-and-3-7/9000/6 "2020-06-19T10:06:06Z")

</div>

That would be another workaround option yes. As mentioned I chose to use `pip install -U -r requirements.txt` instead, which also works.

The new pip resolver should hopefully fix this problem yes, but it doesn’t change the observation that de (default) python3.6 and python3.7 have relatively old pytest versions built-in. Defaulting those specifications to the most recent subrelease would be very helpful for that already too 🙂
