File tree Expand file tree Collapse file tree 4 files changed +61
-5
lines changed Expand file tree Collapse file tree 4 files changed +61
-5
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,11 @@ defaults:
1313
1414env :
1515 PYTHONIOENCODING : ' utf-8' # For log color
16- PY_COLORS : 1 # For log color with pytest
16+
17+ # This enable log color of pytest.
18+ # --color=yes option is not working on GitHub Action.
19+ # See https://github.com/pytest-dev/pytest/issues/1397.
20+ PY_COLORS : 1
1721
1822jobs :
1923 pytest :
8791 libopengl0
8892
8993 - name : Run pytest
90- run : poetry run pytest --cov --cov-report=term-missing --cov-report=xml
94+ run : |
95+ poetry run pytest \
96+ --cov \
97+ --cov-report=term-missing \
98+ --cov-report=xml \
99+ -n auto
91100
92101 - name : Upload coverage to Codecov
93102 uses : codecov/codecov-action@v3
@@ -150,7 +159,8 @@ jobs:
150159 --cov-report=xml \
151160 --ignore=tests/test_widget_gallery.py \
152161 --ignore=tests/test_qdarktheme_with_qt.py \
153- -p no:pytest-qt
162+ -p no:pytest-qt \
163+ -n auto
154164
155165 - name : Upload coverage to Codecov
156166 uses : codecov/codecov-action@v3
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ pytest-randomly = "^3.12.0"
5858pytest-qt = " ^4.2.0"
5959pytest-xvfb = " ^2.0.0"
6060pytest-mock = " ^3.10.0"
61+ pytest-xdist = " ^3.0.2"
6162
6263[tool .poetry .group .docs .dependencies ]
6364# Latest of Sphinx and flake8 cause dependency comflict.
Original file line number Diff line number Diff line change @@ -116,8 +116,17 @@ def test_load_stylesheet_when_failing_to_detect_system_theme(mocker) -> None:
116116 qdarktheme .load_stylesheet ("auto" )
117117
118118
119- def test_clear_cache () -> None :
119+ def test_clear_cache (mocker ) -> None :
120120 """Verify `clear_cache()`."""
121+ from pathlib import Path
122+
123+ # qdarktheme cache save to system home path.
124+ # Cannot clear cache because another tests use cache in home path.
125+ # This mock make home path dummy home path.
126+ dummy_home_path = Path ("__dummy" )
127+ dummy_home_path .mkdir (exist_ok = True )
128+ mocker .patch ("pathlib.Path.home" , return_value = dummy_home_path )
129+
121130 qdarktheme .load_stylesheet ()
122131 qdarktheme .clear_cache ()
123132 # Test function when there is no cache.
You can’t perform that action at this time.
0 commit comments