Skip to content

Commit 7ad625b

Browse files
committed
Fix tests
1 parent 2c3597c commit 7ad625b

9 files changed

+46
-6
lines changed

.github/workflows/test.yml

+27-4
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,35 @@ jobs:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
python-version: ['2.7', '3.5', '3.6', '3.7', '3.8', '3.9', '3.10', pypy-2.7, pypy-3.7, pypy-3.8]
36-
os: [ubuntu-18.04]
35+
python-version: ['3.7', '3.8', '3.9', '3.10']
36+
os: [ubuntu-latest]
37+
mark: [all]
3738
include:
39+
# TODO: drop old Python versions in v2.0 release
40+
- os: ubuntu-18.04
41+
mark: all
42+
python-version: '2.7'
43+
- os: ubuntu-18.04
44+
mark: all
45+
python-version: '3.5'
46+
- os: ubuntu-18.04
47+
mark: all
48+
python-version: '3.6'
49+
- os: ubuntu-18.04
50+
mark: important
51+
python-version: pypy-2.7
52+
# run only limited set of tests here because it takes too long
53+
- os: ubuntu-latest
54+
mark: important
55+
python-version: pypy-3.7
56+
- os: ubuntu-latest
57+
mark: important
58+
python-version: pypy-3.8
3859
- os: macos-latest
60+
mark: important
3961
python-version: '3.10'
4062
- os: windows-latest
63+
mark: important
4164
python-version: '3.10'
4265

4366
steps:
@@ -84,8 +107,8 @@ jobs:
84107
- name: Run tests
85108
run: |
86109
mkdir reports/
87-
pip install dist/*.whl
88-
coverage run -m pytest --reruns 5
110+
pip install -e . --no-build-isolation
111+
coverage run -m pytest --reruns 5 -m ${{ matrix.mark }}
89112
90113
- name: Combine coverage
91114
run: |

pytest.ini

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pytest]
2+
markers =
3+
all: mark all tests
4+
important: mark only important tests (e.g. functions which depend on OS and Python version)

tests/conftest.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ def create_file(
5454
log.info(execute(cwd, "git diff"))
5555

5656
if commit:
57-
msg = "Add {}".format(name)
58-
execute(cwd, "git commit -m {msg}".format(msg=cmd_quote(msg)))
57+
execute(cwd, "git commit -m 'Add {name}'".format(name=name))
5958
result = get_short_commit(cwd)
6059

6160
return result

tests/test_branch_formatter.py

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from tests.conftest import execute, create_file, get_version
88

9+
pytestmark = pytest.mark.all
10+
911

1012
@pytest.mark.parametrize(
1113
"branch, suffix",

tests/test_config.py

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from tests.conftest import get_version, get_version_setup_py, create_file, create_pyproject_toml, create_setup_py
88

9+
pytestmark = [pytest.mark.all, pytest.mark.important]
10+
911

1012
def test_config_not_set(repo, create_config):
1113
create_config(repo, NotImplemented)

tests/test_substitution.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from tests.conftest import execute, get_version
66

7+
pytestmark = pytest.mark.all
8+
79

810
@pytest.mark.parametrize(
911
"branch, suffix",

tests/test_tag.py

+3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
from tests.conftest import execute, create_file, get_commit, get_version, get_short_commit
66

7+
pytestmark = pytest.mark.all
78

9+
10+
@pytest.mark.important
811
@pytest.mark.parametrize(
912
"template, subst",
1013
[

tests/test_version_callback.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
from tests.conftest import execute, create_file, get_version, get_version_setup_py
55

6+
pytestmark = pytest.mark.all
7+
68

79
VERSION_PY = """def get_version():
810
return "{version}"

tests/test_version_file.py

+3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
from tests.conftest import execute, create_file, get_commit, get_version, get_short_commit
44

5+
pytestmark = pytest.mark.all
56

7+
8+
@pytest.mark.important
69
@pytest.mark.parametrize(
710
"template",
811
[

0 commit comments

Comments
 (0)