Skip to content

Commit 71dee33

Browse files
adamchainzBenRKarl
authored andcommitted
Use unittest's --buffer option
1 parent 1c56079 commit 71dee33

1 file changed

Lines changed: 21 additions & 28 deletions

File tree

noxfile.py

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@
1616

1717
PYTHON_VERSIONS = ["3.7"]
1818

19+
TEST_COMMAND = [
20+
"coverage",
21+
"run",
22+
"--append",
23+
"-m",
24+
"unittest",
25+
"discover",
26+
"--buffer",
27+
"-s=tests",
28+
"-p",
29+
"*_test.py",
30+
]
31+
COVERAGE_COMMAND = [
32+
"coverage", "report", "-m", "--omit=.nox/*,examples/*,*/__init__.py",
33+
]
34+
1935

2036
@nox.session(python=PYTHON_VERSIONS)
2137
def tests(session):
@@ -25,20 +41,9 @@ def tests(session):
2541
"pyfakefs>=3.5,<3.7",
2642
"coverage==6.5.0",
2743
)
28-
session.run(
29-
"coverage",
30-
"run",
31-
"--append",
32-
"-m",
33-
"unittest",
34-
"discover",
35-
"-s=tests",
36-
"-p",
37-
"*_test.py",
38-
)
39-
session.run(
40-
"coverage", "report", "-m", "--omit=.nox/*,examples/*,*/__init__.py"
41-
)
44+
session.run(*TEST_COMMAND)
45+
session.run(*COVERAGE_COMMAND)
46+
4247

4348
# This session runs all the unit tests but with the lowest-possible versions
4449
# of supported dependencies that are published by Google.
@@ -59,17 +64,5 @@ def tests_minimum_dependency_versions(session):
5964
"grpcio==1.38.1",
6065
"grpcio-status==1.38.1",
6166
)
62-
session.run(
63-
"coverage",
64-
"run",
65-
"--append",
66-
"-m",
67-
"unittest",
68-
"discover",
69-
"-s=tests",
70-
"-p",
71-
"*_test.py",
72-
)
73-
session.run(
74-
"coverage", "report", "-m", "--omit=.nox/*,examples/*,*/__init__.py"
75-
)
67+
session.run(*TEST_COMMAND)
68+
session.run(*COVERAGE_COMMAND)

0 commit comments

Comments
 (0)