Skip to content

Commit ff1e936

Browse files
authored
test: update nox file to build and test wheels (#1295)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/google-api-python-client/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) Fixes #1235 🦕 In an attempt to verify that this is a fix for #1235 I'm going push a commit that removes the fix from #1221 in this PR and confirm that the checks fail.
1 parent 937ae84 commit ff1e936

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

noxfile.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import sys
1717

1818
import nox
19+
import os
20+
import shutil
1921

2022
test_dependencies = [
2123
"django>=2.0.0",
@@ -58,9 +60,22 @@ def lint(session):
5860
],
5961
)
6062
def unit(session, oauth2client):
63+
# Clean up dist and build folders
64+
shutil.rmtree('dist', ignore_errors=True)
65+
shutil.rmtree('build', ignore_errors=True)
66+
6167
session.install(*test_dependencies)
6268
session.install(oauth2client)
63-
session.install('.')
69+
70+
# Create and install wheels
71+
session.run('python3', 'setup.py', 'bdist_wheel')
72+
session.install(os.path.join('dist', os.listdir('dist').pop()))
73+
74+
# Run tests from a different directory to test the package artifacts
75+
root_dir = os.path.dirname(os.path.realpath(__file__))
76+
temp_dir = session.create_tmp()
77+
session.chdir(temp_dir)
78+
shutil.copytree(os.path.join(root_dir, 'tests'), 'tests')
6479

6580
# Run py.test against the unit tests.
6681
session.run(

0 commit comments

Comments
 (0)