Skip to content

Explicit auth tests #170

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

Closed
wants to merge 23 commits into from
Closed

Conversation

max-sixty
Copy link
Contributor

@max-sixty max-sixty commented Apr 29, 2018

After I neglected #127 and @tswast valiantly completed the bulk, there were a couple of useful unrelated pieces that are also worth adding

Here, tests are explicitly marked with auth type so, for example, if pytest -m 'not s_path_auth' is run, it won't run any tests with service path auth
Travis is then parameterized by the command it's passed, rather than the tests themselves checking whether they're running in travis

Copy link
Collaborator

@tswast tswast left a comment

Choose a reason for hiding this comment

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

Thanks!

nox.py Outdated
@@ -21,6 +20,12 @@ def default(session):
'pytest',
os.path.join('.', 'tests', 'unit'),
os.path.join('.', 'tests', 'system.py'),
os.path.join('.', 'tests', 'unit'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like unit tests got included twice.

tests/system.py Outdated
@@ -205,6 +220,7 @@ def test_should_be_able_to_get_results_from_query(self, gbq_connector):
assert pages is not None


@pytest.mark.local_auth
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like test_get_application_default_credentials_does_not_throw_error and test_get_application_default_credentials_returns_credentials are working just fine on Travis if you want to move this to the test_get_user_account_credentials_XXX methods.

tswast added 2 commits May 4, 2018 09:55
Also, fixes failure in nox config when AUTH environment variable is not
set.
@tswast
Copy link
Collaborator

tswast commented May 4, 2018

This doesn't seem to be skipping local auth tests no matter where I put the mark. :-(

$ nox -s default -r | grep TestAuth
nox > Running session default
nox > Re-using existing virtualenv at /Users/swast/src/pandas/pandas-gbq/.nox/default.
nox > chdir /Users/swast/src/pandas/pandas-gbq
nox > Skipping installation of "mock pytest pytest-cov".
nox > Skipping installation of "-e .".
nox > pytest ./tests/unit ./tests/system.py -m 'not local_auth and not s_path_auth' -v --cov=pandas_gbq --cov=tests.unit --cov-report xml:/tmp/pytest-cov.xml
tests/system.py::TestAuth::test_get_application_default_credentials_does_not_throw_error[env] PASSED [ 33%]
tests/system.py::TestAuth::test_get_application_default_credentials_returns_credentials[env] PASSED [ 33%]
tests/system.py::TestAuth::test_get_user_account_credentials_bad_file_returns_credentials[env] PASSED [ 34%]
tests/system.py::TestAuth::test_get_user_account_credentials_returns_credentials[env] PASSED [ 35%]
^Cnox > Interrupted...
nox > Session default interrupted.

@max-sixty
Copy link
Contributor Author

Discovery, though not solution - if there's a legacy-style autouse=True fixture, even the explicit marking (like you added) doesn't work.

We could try and resolve, or move to new-style tests (which would be preferable, but non-zero work)

@tswast
Copy link
Collaborator

tswast commented May 4, 2018

Ugh. Okay, well I've wanted to move to new-style tests for a while. (Already did it with the unit tests.) I'll see if I can get a PR to refactor the system tests out today.

@tswast
Copy link
Collaborator

tswast commented May 5, 2018

Well, I only got to the auth tests, but it's a start. #176

@tswast
Copy link
Collaborator

tswast commented Jun 8, 2018

Closing in favor of #176 changes.

@tswast tswast closed this Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants