diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 2e8b2b82..355b1dd1 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -18,4 +18,4 @@ jobs: run: | cd ./clients/python pip install -r requirements.txt -r test-requirements.txt - python -m unittest + pytest diff --git a/clients/python/test/test_locales_api.py b/clients/python/test/test_locales_api.py index 0ce1e0f2..d6371c8b 100644 --- a/clients/python/test/test_locales_api.py +++ b/clients/python/test/test_locales_api.py @@ -12,7 +12,12 @@ from __future__ import absolute_import import unittest -from unittest.mock import Mock, patch +import sys + +if sys.version_info[:2] <= (3, 7): + from mock import Mock, patch +else: + from unittest.mock import Mock, patch import phrase_api diff --git a/clients/python/test/test_uploads_api.py b/clients/python/test/test_uploads_api.py index 91289544..8e65d57b 100644 --- a/clients/python/test/test_uploads_api.py +++ b/clients/python/test/test_uploads_api.py @@ -12,7 +12,12 @@ from __future__ import absolute_import import unittest -from unittest.mock import Mock, patch +import sys + +if sys.version_info[:2] <= (3, 7): + from mock import Mock, patch +else: + from unittest.mock import Mock, patch import phrase_api from phrase_api.api.uploads_api import UploadsApi # noqa: E501 diff --git a/openapi-generator/templates/python/test-requirements.mustache b/openapi-generator/templates/python/test-requirements.mustache index 12021b47..9cd7eefa 100644 --- a/openapi-generator/templates/python/test-requirements.mustache +++ b/openapi-generator/templates/python/test-requirements.mustache @@ -6,7 +6,10 @@ py>=1.4.31 randomize>=0.13 {{/useNose}} {{^useNose}} -pytest~=4.6.7 # needed for python 2.7+3.4 pytest-cov>=2.8.1 pytest-randomly==1.2.3 # needed for python 2.7+3.4 + +pytest~=4.6.7; python_version < "3.7" +pytest~=7.1; python_version >= "3.7" +mock; python_version <= "3.7" {{/useNose}} \ No newline at end of file