Skip to content

Commit 30fb8f4

Browse files
authored
Making a nox -s default session for all packages. (#4324)
* Making a `nox -s default` session for all packages. * Using "default" `nox` session on AppVeyor. This was 32-bit or 64-bit Python can be used, depending on which is the active `python` / the active `nox.exe`.
1 parent 548cf5f commit 30fb8f4

File tree

22 files changed

+516
-219
lines changed

22 files changed

+516
-219
lines changed

api_core/nox.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@
1919

2020

2121
@nox.session
22-
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
23-
def unit(session, py):
24-
"""Run the unit test suite."""
25-
26-
# Run unit tests against all supported versions of Python.
27-
session.interpreter = 'python{}'.format(py)
28-
29-
# Set the virtualenv dirname.
30-
session.virtualenv_dirname = 'unit-' + py
22+
def default(session):
23+
"""Default unit test session.
3124
25+
This is intended to be run **without** an interpreter set, so
26+
that the current ``python`` (on the ``PATH``) or the version of
27+
Python corresponding to the ``nox`` binary the ``PATH`` can
28+
run the tests.
29+
"""
3230
# Install all test dependencies, then install this package in-place.
3331
session.install(
3432
'mock',
@@ -53,6 +51,20 @@ def unit(session, py):
5351
)
5452

5553

54+
@nox.session
55+
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
56+
def unit(session, py):
57+
"""Run the unit test suite."""
58+
59+
# Run unit tests against all supported versions of Python.
60+
session.interpreter = 'python{}'.format(py)
61+
62+
# Set the virtualenv dirname.
63+
session.virtualenv_dirname = 'unit-' + py
64+
65+
default(session)
66+
67+
5668
@nox.session
5769
def lint(session):
5870
"""Run linters.

appveyor.yml

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ environment:
1414
# iterations.
1515

1616
- PYTHON: "C:\\Python27"
17-
NOX_ENV: "unit(py='2.7')"
18-
1917
- PYTHON: "C:\\Python35-x64"
20-
NOX_ENV: "unit(py='3.5')"
2118

2219
install:
2320
- cmd: echo "Filesystem root:"
@@ -51,24 +48,24 @@ install:
5148

5249
test_script:
5350
# Run the project tests
54-
- "%PYTHON%\\Scripts\\nox.exe -f api_core\\nox.py -s %NOX_ENV%"
55-
- "%PYTHON%\\Scripts\\nox.exe -f bigquery\\nox.py -s %NOX_ENV%"
56-
- "%PYTHON%\\Scripts\\nox.exe -f bigtable\\nox.py -s %NOX_ENV%"
57-
- "%PYTHON%\\Scripts\\nox.exe -f core\\nox.py -s %NOX_ENV%"
58-
- "%PYTHON%\\Scripts\\nox.exe -f datastore\\nox.py -s %NOX_ENV%"
59-
- "%PYTHON%\\Scripts\\nox.exe -f dns\\nox.py -s %NOX_ENV%"
60-
- "%PYTHON%\\Scripts\\nox.exe -f error_reporting\\nox.py -s %NOX_ENV%"
61-
- "%PYTHON%\\Scripts\\nox.exe -f firestore\\nox.py -s %NOX_ENV%"
62-
- "%PYTHON%\\Scripts\\nox.exe -f language\\nox.py -s %NOX_ENV%"
63-
- "%PYTHON%\\Scripts\\nox.exe -f logging\\nox.py -s %NOX_ENV%"
64-
- "%PYTHON%\\Scripts\\nox.exe -f monitoring\\nox.py -s %NOX_ENV%"
65-
- "%PYTHON%\\Scripts\\nox.exe -f pubsub\\nox.py -s %NOX_ENV%"
66-
- "%PYTHON%\\Scripts\\nox.exe -f resource_manager\\nox.py -s %NOX_ENV%"
67-
- "%PYTHON%\\Scripts\\nox.exe -f runtimeconfig\\nox.py -s %NOX_ENV%"
68-
- "%PYTHON%\\Scripts\\nox.exe -f spanner\\nox.py -s %NOX_ENV%"
69-
- "%PYTHON%\\Scripts\\nox.exe -f speech\\nox.py -s %NOX_ENV%"
70-
- "%PYTHON%\\Scripts\\nox.exe -f storage\\nox.py -s %NOX_ENV%"
71-
- "%PYTHON%\\Scripts\\nox.exe -f trace\\nox.py -s %NOX_ENV%"
72-
- "%PYTHON%\\Scripts\\nox.exe -f translate\\nox.py -s %NOX_ENV%"
73-
- "%PYTHON%\\Scripts\\nox.exe -f videointelligence\\nox.py -s %NOX_ENV%"
74-
- "%PYTHON%\\Scripts\\nox.exe -f vision\\nox.py -s %NOX_ENV%"
51+
- "%PYTHON%\\Scripts\\nox.exe -f api_core\\nox.py -s default"
52+
- "%PYTHON%\\Scripts\\nox.exe -f bigquery\\nox.py -s default"
53+
- "%PYTHON%\\Scripts\\nox.exe -f bigtable\\nox.py -s default"
54+
- "%PYTHON%\\Scripts\\nox.exe -f core\\nox.py -s default"
55+
- "%PYTHON%\\Scripts\\nox.exe -f datastore\\nox.py -s default"
56+
- "%PYTHON%\\Scripts\\nox.exe -f dns\\nox.py -s default"
57+
- "%PYTHON%\\Scripts\\nox.exe -f error_reporting\\nox.py -s default"
58+
- "%PYTHON%\\Scripts\\nox.exe -f firestore\\nox.py -s default"
59+
- "%PYTHON%\\Scripts\\nox.exe -f language\\nox.py -s default"
60+
- "%PYTHON%\\Scripts\\nox.exe -f logging\\nox.py -s default"
61+
- "%PYTHON%\\Scripts\\nox.exe -f monitoring\\nox.py -s default"
62+
- "%PYTHON%\\Scripts\\nox.exe -f pubsub\\nox.py -s default"
63+
- "%PYTHON%\\Scripts\\nox.exe -f resource_manager\\nox.py -s default"
64+
- "%PYTHON%\\Scripts\\nox.exe -f runtimeconfig\\nox.py -s default"
65+
- "%PYTHON%\\Scripts\\nox.exe -f spanner\\nox.py -s default"
66+
- "%PYTHON%\\Scripts\\nox.exe -f speech\\nox.py -s default"
67+
- "%PYTHON%\\Scripts\\nox.exe -f storage\\nox.py -s default"
68+
- "%PYTHON%\\Scripts\\nox.exe -f trace\\nox.py -s default"
69+
- "%PYTHON%\\Scripts\\nox.exe -f translate\\nox.py -s default"
70+
- "%PYTHON%\\Scripts\\nox.exe -f videointelligence\\nox.py -s default"
71+
- "%PYTHON%\\Scripts\\nox.exe -f vision\\nox.py -s default"

bigquery/nox.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@
2626

2727

2828
@nox.session
29-
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
30-
def unit(session, py):
31-
"""Run the unit test suite."""
32-
33-
# Run unit tests against all supported versions of Python.
34-
session.interpreter = 'python{}'.format(py)
35-
36-
# Set the virtualenv dirname.
37-
session.virtualenv_dirname = 'unit-' + py
29+
def default(session):
30+
"""Default unit test session.
3831
32+
This is intended to be run **without** an interpreter set, so
33+
that the current ``python`` (on the ``PATH``) or the version of
34+
Python corresponding to the ``nox`` binary the ``PATH`` can
35+
run the tests.
36+
"""
3937
# Install all test dependencies, then install this package in-place.
4038
session.install('mock', 'pytest', 'pytest-cov', *LOCAL_DEPS)
4139
session.install('-e', '.')
@@ -55,6 +53,20 @@ def unit(session, py):
5553
)
5654

5755

56+
@nox.session
57+
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
58+
def unit(session, py):
59+
"""Run the unit test suite."""
60+
61+
# Run unit tests against all supported versions of Python.
62+
session.interpreter = 'python{}'.format(py)
63+
64+
# Set the virtualenv dirname.
65+
session.virtualenv_dirname = 'unit-' + py
66+
67+
default(session)
68+
69+
5870
@nox.session
5971
@nox.parametrize('py', ['2.7', '3.6'])
6072
def system(session, py):

bigtable/nox.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@
2525

2626

2727
@nox.session
28-
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
29-
def unit(session, py):
30-
"""Run the unit test suite."""
31-
32-
# Run unit tests against all supported versions of Python.
33-
session.interpreter = 'python{}'.format(py)
34-
35-
# Set the virtualenv dirname.
36-
session.virtualenv_dirname = 'unit-' + py
28+
def default(session):
29+
"""Default unit test session.
3730
31+
This is intended to be run **without** an interpreter set, so
32+
that the current ``python`` (on the ``PATH``) or the version of
33+
Python corresponding to the ``nox`` binary the ``PATH`` can
34+
run the tests.
35+
"""
3836
# Install all test dependencies, then install this package in-place.
3937
session.install('mock', 'pytest', 'pytest-cov', *LOCAL_DEPS)
4038
session.install('-e', '.')
@@ -54,6 +52,20 @@ def unit(session, py):
5452
)
5553

5654

55+
@nox.session
56+
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
57+
def unit(session, py):
58+
"""Run the unit test suite."""
59+
60+
# Run unit tests against all supported versions of Python.
61+
session.interpreter = 'python{}'.format(py)
62+
63+
# Set the virtualenv dirname.
64+
session.virtualenv_dirname = 'unit-' + py
65+
66+
default(session)
67+
68+
5769
@nox.session
5870
@nox.parametrize('py', ['2.7', '3.6'])
5971
def system(session, py):

core/nox.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,14 @@
2424

2525

2626
@nox.session
27-
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
28-
def unit(session, py):
29-
"""Run the unit test suite."""
30-
31-
# Run unit tests against all supported versions of Python.
32-
session.interpreter = 'python{}'.format(py)
33-
34-
# Set the virtualenv dirname.
35-
session.virtualenv_dirname = 'unit-' + py
27+
def default(session):
28+
"""Default unit test session.
3629
30+
This is intended to be run **without** an interpreter set, so
31+
that the current ``python`` (on the ``PATH``) or the version of
32+
Python corresponding to the ``nox`` binary the ``PATH`` can
33+
run the tests.
34+
"""
3735
# Install all test dependencies, then install this package in-place.
3836
session.install(
3937
'mock',
@@ -59,6 +57,20 @@ def unit(session, py):
5957
)
6058

6159

60+
@nox.session
61+
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
62+
def unit(session, py):
63+
"""Run the unit test suite."""
64+
65+
# Run unit tests against all supported versions of Python.
66+
session.interpreter = 'python{}'.format(py)
67+
68+
# Set the virtualenv dirname.
69+
session.virtualenv_dirname = 'unit-' + py
70+
71+
default(session)
72+
73+
6274
@nox.session
6375
def lint(session):
6476
"""Run linters.

datastore/nox.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@
2626

2727

2828
@nox.session
29-
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
30-
def unit(session, py):
31-
"""Run the unit test suite."""
32-
33-
# Run unit tests against all supported versions of Python.
34-
session.interpreter = 'python{}'.format(py)
35-
36-
# Set the virtualenv dirname.
37-
session.virtualenv_dirname = 'unit-' + py
29+
def default(session):
30+
"""Default unit test session.
3831
32+
This is intended to be run **without** an interpreter set, so
33+
that the current ``python`` (on the ``PATH``) or the version of
34+
Python corresponding to the ``nox`` binary the ``PATH`` can
35+
run the tests.
36+
"""
3937
# Install all test dependencies, then install this package in-place.
4038
session.install('mock', 'pytest', 'pytest-cov', *LOCAL_DEPS)
4139
session.install('-e', '.')
@@ -55,6 +53,20 @@ def unit(session, py):
5553
)
5654

5755

56+
@nox.session
57+
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
58+
def unit(session, py):
59+
"""Run the unit test suite."""
60+
61+
# Run unit tests against all supported versions of Python.
62+
session.interpreter = 'python{}'.format(py)
63+
64+
# Set the virtualenv dirname.
65+
session.virtualenv_dirname = 'unit-' + py
66+
67+
default(session)
68+
69+
5870
@nox.session
5971
@nox.parametrize('py', ['2.7', '3.6'])
6072
def system(session, py):

dns/nox.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,33 @@
2525
)
2626

2727

28+
@nox.session
29+
def default(session):
30+
"""Default unit test session.
31+
32+
This is intended to be run **without** an interpreter set, so
33+
that the current ``python`` (on the ``PATH``) or the version of
34+
Python corresponding to the ``nox`` binary the ``PATH`` can
35+
run the tests.
36+
"""
37+
# Install all test dependencies, then install this package in-place.
38+
session.install('mock', 'pytest', 'pytest-cov', *LOCAL_DEPS)
39+
session.install('-e', '.')
40+
41+
# Run py.test against the unit tests.
42+
session.run(
43+
'py.test',
44+
'--quiet',
45+
'--cov=google.cloud.dns',
46+
'--cov=tests.unit',
47+
'--cov-append',
48+
'--cov-config=.coveragerc',
49+
'--cov-report=',
50+
'--cov-fail-under=97',
51+
'tests/unit',
52+
)
53+
54+
2855
@nox.session
2956
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
3057
def unit(session, py):
@@ -36,16 +63,7 @@ def unit(session, py):
3663
# Set the virtualenv dirname.
3764
session.virtualenv_dirname = 'unit-' + py
3865

39-
# Install all test dependencies, then install this package in-place.
40-
session.install('mock', 'pytest', 'pytest-cov', *LOCAL_DEPS)
41-
session.install('-e', '.')
42-
43-
# Run py.test against the unit tests.
44-
session.run('py.test', '--quiet',
45-
'--cov=google.cloud.dns', '--cov=tests.unit', '--cov-append',
46-
'--cov-config=.coveragerc', '--cov-report=', '--cov-fail-under=97',
47-
'tests/unit',
48-
)
66+
default(session)
4967

5068

5169
@nox.session

error_reporting/nox.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,33 @@
2626
)
2727

2828

29+
@nox.session
30+
def default(session):
31+
"""Default unit test session.
32+
33+
This is intended to be run **without** an interpreter set, so
34+
that the current ``python`` (on the ``PATH``) or the version of
35+
Python corresponding to the ``nox`` binary the ``PATH`` can
36+
run the tests.
37+
"""
38+
# Install all test dependencies, then install this package in-place.
39+
session.install('mock', 'pytest', 'pytest-cov', *LOCAL_DEPS)
40+
session.install('-e', '.')
41+
42+
# Run py.test against the unit tests.
43+
session.run(
44+
'py.test',
45+
'--quiet',
46+
'--cov=google.cloud.error_reporting',
47+
'--cov=tests.unit',
48+
'--cov-append',
49+
'--cov-config=.coveragerc',
50+
'--cov-report=',
51+
'--cov-fail-under=97',
52+
'tests/unit',
53+
)
54+
55+
2956
@nox.session
3057
@nox.parametrize('py', ['2.7', '3.4', '3.5', '3.6'])
3158
def unit(session, py):
@@ -37,16 +64,7 @@ def unit(session, py):
3764
# Set the virtualenv dirname.
3865
session.virtualenv_dirname = 'unit-' + py
3966

40-
# Install all test dependencies, then install this package in-place.
41-
session.install('mock', 'pytest', 'pytest-cov', *LOCAL_DEPS)
42-
session.install('-e', '.')
43-
44-
# Run py.test against the unit tests.
45-
session.run(
46-
'py.test', '--quiet', '--cov=google.cloud.error_reporting',
47-
'--cov=tests.unit', '--cov-append', '--cov-config=.coveragerc',
48-
'--cov-report=', '--cov-fail-under=97', 'tests/unit',
49-
)
67+
default(session)
5068

5169

5270
@nox.session

0 commit comments

Comments
 (0)