Repository: libcloud Updated Branches: refs/heads/trunk 50995f444 -> 48bb90ee7
test: check that secrets.py is up-to-date Closes #1096 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/48bb90ee Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/48bb90ee Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/48bb90ee Branch: refs/heads/trunk Commit: 48bb90ee7c514c0f580e509894076964e02c09cb Parents: 50995f4 Author: Quentin Pradet <[email protected]> Authored: Tue Aug 29 15:53:24 2017 +0400 Committer: Anthony Shaw <[email protected]> Committed: Mon Sep 4 08:35:59 2017 +1000 ---------------------------------------------------------------------- libcloud/test/conftest.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/48bb90ee/libcloud/test/conftest.py ---------------------------------------------------------------------- diff --git a/libcloud/test/conftest.py b/libcloud/test/conftest.py new file mode 100644 index 0000000..505c570 --- /dev/null +++ b/libcloud/test/conftest.py @@ -0,0 +1,25 @@ +import os.path +import pytest + + +def pytest_configure(config): + """Check that secrets.py is valid""" + + this_dir = os.path.abspath(os.path.split(__file__)[0]) + secrets_current = os.path.join(this_dir, 'secrets.py') + secrets_dist = os.path.join(this_dir, 'secrets.py-dist') + + if not os.path.isfile(secrets_current): + print("Missing " + secrets_current) + print("Maybe you forgot to copy it from -dist:") + print("cp libcloud/test/secrets.py-dist libcloud/test/secrets.py") + pytest.exit('') + + mtime_current = os.path.getmtime(secrets_current) + mtime_dist = os.path.getmtime(secrets_dist) + + if mtime_dist > mtime_current: + print("It looks like test/secrets.py file is out of date.") + print("Please copy the new secrets.py-dist file over otherwise" + + " tests might fail") + pytest.exit('')
