Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enforce constraints during unit tests #760

Merged
merged 1 commit into from May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 14 additions & 5 deletions noxfile.py
Expand Up @@ -12,10 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import shutil
import os
import pathlib
import shutil

import nox

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()

TEST_DEPENDENCIES = [
"flask",
"freezegun",
Expand Down Expand Up @@ -84,15 +88,20 @@ def blacken(session):

@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
def unit(session):
session.install(*TEST_DEPENDENCIES)
session.install(*(ASYNC_DEPENDENCIES))
session.install(".")
constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
add_constraints = ["-c", constraints_path]
session.install(*(TEST_DEPENDENCIES + add_constraints))
session.install(*(ASYNC_DEPENDENCIES + add_constraints))
session.install(".", *add_constraints)
session.run(
"pytest",
f"--junitxml=unit_{session.python}_sponge_log.xml",
"--cov=google.auth",
"--cov=google.oauth2",
"--cov=tests",
"--cov-report=term-missing",
"tests",
"tests_async",
)
Expand Down Expand Up @@ -123,7 +132,7 @@ def cover(session):
"--cov=google.oauth2",
"--cov=tests",
"--cov=tests_async",
"--cov-report=",
"--cov-report=term-missing",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If lines aren't being covered, then the report should include them, so that the hapless developer can figure out why. I've never understood why that isn't the default behavior for the report.

"tests",
"tests_async",
)
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Expand Up @@ -33,8 +33,7 @@
extras = {
"aiohttp": [
"aiohttp >= 3.6.2, < 4.0.0dev; python_version>='3.6'",
"requests >= 2.18.0, < 3.0.0dev",
"urllib3 >= 1.0.0, <2.0.0dev",
"requests >= 2.20.0, < 3.0.0dev",
],
"pyopenssl": "pyopenssl>=20.0.0",
"reauth": "pyu2f>=0.1.5",
Expand Down
4 changes: 1 addition & 3 deletions testing/constraints-3.6.txt
Expand Up @@ -9,8 +9,6 @@ cachetools==2.0.0
pyasn1-modules==0.2.1
setuptools==40.3.0
six==1.9.0
rsa==4.6
rsa==3.1.4
aiohttp==3.6.2
requests==2.18.0
urllib3==1.0.0
requests==2.20.0