diff options
author | Jon Wayne Parrott <jonwayne@google.com> | 2016-08-08 14:52:13 -0700 |
---|---|---|
committer | Pat Ferate <pferate+github@gmail.com> | 2016-08-09 14:41:14 -0700 |
commit | 4cac96d1a829e3e4e7b28c58c121db728a4d39c6 (patch) | |
tree | 90680217c51715ca3e8b4a20924aa10b89a58c60 /tests/conftest.py | |
parent | c359c401e74f26c2b73403f7a756ccb93b571f32 (diff) | |
download | oauth2client-4cac96d1a829e3e4e7b28c58c121db728a4d39c6.tar.gz |
Re-configure App engine tests
Diffstat (limited to 'tests/conftest.py')
-rw-r--r-- | tests/conftest.py | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 5d53edd..caadb80 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -12,35 +12,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Common testing tools for OAuth2Client tests.""" +"""Py.test hooks.""" -import sys +from oauth2client import _helpers -from six.moves import reload_module -from oauth2client import util +def pytest_addoption(parser): + """Adds the --gae-sdk option to py.test. - -def set_up_gae_environment(gae_sdk_path): - """Set up appengine SDK third-party imports.""" - if 'google' in sys.modules: - # Some packages, such as protobuf, clobber the google - # namespace package. This prevents that. - reload_module(sys.modules['google']) - - # This sets up google-provided libraries. - sys.path.insert(0, gae_sdk_path) - import dev_appserver - dev_appserver.fix_sys_path() - - # Fixes timezone and other os-level items. - import google.appengine.tools.os_compat # noqa: unused import + This is used to enable the GAE tests. This has to be in this conftest.py + due to the way py.test collects conftest files.""" + parser.addoption('--gae-sdk') def pytest_configure(config): - """Pytest hook function for setting up test session.""" - # Set up Google SDK modules unless specified not to - if not config.option.no_gae: - set_up_gae_environment(config.option.sdk_path) + """Py.test hook called before loading tests.""" # Default of POSITIONAL_WARNING is too verbose for testing - util.positional_parameters_enforcement = util.POSITIONAL_EXCEPTION + _helpers.positional_parameters_enforcement = _helpers.POSITIONAL_EXCEPTION |