Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit 811d190

Browse files
authored
Restructure the package (#92)
1 parent cdb0a80 commit 811d190

118 files changed

Lines changed: 128 additions & 205 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ jobs:
2929
command: |
3030
if [ -n "$GOOGLE_APPLICATION_CREDENTIALS" ]; then
3131
openssl aes-256-cbc -d -a -k "$GOOGLE_CREDENTIALS_PASSPHRASE" \
32-
-in trace/tests/system/credentials.json.enc \
33-
-out trace/$GOOGLE_APPLICATION_CREDENTIALS
32+
-in tests/system/trace/credentials.json.enc \
33+
-out $GOOGLE_APPLICATION_CREDENTIALS
3434
else
3535
echo "No credentials. System tests will not run."
3636
fi
3737
- run:
38-
name: Run tests - opencensus.trace
38+
name: Run tests - opencensus
3939
command: |
40-
nox -f trace/nox.py
40+
nox -f nox.py
File renamed without changes.

README.rst

Lines changed: 10 additions & 10 deletions

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
setuptools >= 36.4.0
22
sphinx >= 1.6.3
33

4-
trace/
4+
.

docs/trace/usage.rst

Lines changed: 10 additions & 10 deletions

nox.py

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,99 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
15+
from __future__ import absolute_import
1616

1717
import nox
18+
import os
19+
20+
21+
@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+
# Install all test dependencies, then install this package in-place.
30+
session.install('-r', 'requirements-test.txt')
31+
32+
session.install('-e', '.')
33+
34+
# Run py.test against the unit tests.
35+
session.run(
36+
'py.test',
37+
'--quiet',
38+
'--cov=opencensus.trace',
39+
'--cov-append',
40+
'--cov-config=.coveragerc',
41+
'--cov-report=',
42+
'--cov-fail-under=97',
43+
'tests/unit/',
44+
*session.posargs
45+
)
46+
47+
48+
@nox.session
49+
@nox.parametrize('py', ['2.7', '3.6'])
50+
def system(session, py):
51+
"""Run the system test suite."""
52+
53+
# Sanity check: Only run system tests if the environment variable is set.
54+
if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
55+
session.skip('Credentials must be set via environment variable.')
56+
57+
# Run the system tests against latest Python 2 and Python 3 only.
58+
session.interpreter = 'python{}'.format(py)
59+
60+
# Set the virtualenv dirname.
61+
session.virtualenv_dirname = 'sys-' + py
62+
63+
# Install all test dependencies, then install this package into the
64+
# virutalenv's dist-packages.
65+
session.install('-r', 'requirements-test.txt')
66+
session.install('.')
67+
68+
# Run py.test against the system tests.
69+
session.run(
70+
'py.test',
71+
'-s',
72+
'tests/system/',
73+
*session.posargs
74+
)
75+
76+
77+
@nox.session
78+
def lint(session):
79+
"""Run flake8.
80+
Returns a failure if flake8 finds linting errors or sufficiently
81+
serious code quality issues.
82+
"""
83+
session.interpreter = 'python3.6'
84+
session.install('flake8')
85+
session.install('.')
86+
session.run('flake8', 'opencensus/trace')
87+
88+
89+
@nox.session
90+
def lint_setup_py(session):
91+
"""Verify that setup.py is valid (including RST check)."""
92+
session.interpreter = 'python3.6'
93+
session.install('docutils', 'pygments')
94+
session.run(
95+
'python', 'setup.py', 'check', '--restructuredtext', '--strict')
96+
97+
98+
@nox.session
99+
def cover(session):
100+
"""Run the final coverage report.
101+
This outputs the coverage report aggregating coverage from the unit
102+
test runs (not system test runs), and then erases coverage data.
103+
"""
104+
session.interpreter = 'python3.6'
105+
session.install('coverage', 'pytest-cov')
106+
session.run('coverage', 'report', '--show-missing', '--fail-under=100')
107+
session.run('coverage', 'erase')
18108

19109

20110
@nox.session
@@ -34,3 +124,4 @@ def docs(session):
34124
# Build the docs!
35125
session.run(
36126
'bash', os.path.join('.', 'scripts', 'update_docs.sh'))
127+
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)