Skip to content

Commit

Permalink
build(python): Adjust test dependencies for Python versions >= 3.7 [T…
Browse files Browse the repository at this point in the history
…SI-2469] (#666)

* build(python) Adjust test dependencies for Python versions >= 3.7

* Use pytest in test workflow

* Fix request mocking for Python <= 3.7
  • Loading branch information
bikmazefe authored Aug 14, 2024
1 parent 49b4b41 commit c218fc2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
run: |
cd ./clients/python
pip install -r requirements.txt -r test-requirements.txt
python -m unittest
pytest
7 changes: 6 additions & 1 deletion clients/python/test/test_locales_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion clients/python/test/test_uploads_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}

0 comments on commit c218fc2

Please sign in to comment.