cevoaustralia / aws-google-auth

Provides AWS STS credentials based on Google Apps SAML SSO auth (what a jumble!)
MIT License
537 stars 181 forks source link

PyPI tarball doesn't include tests data files #120

Open marsam opened 5 years ago

marsam commented 5 years ago

The released PyPI tarball doesn't include the following test data files, required for the tests:

failing tests ``` ... ====================================================================== ERROR: test_invalid_saml_expired_before_valid (aws_google_auth.tests.test_amazon.TestAmazon) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_amazon.py", line 61, in test_invalid_saml_expired_before_valid saml_xml = self.read_local_file('saml-response-expired-before-valid.xml') File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_amazon.py", line 24, in read_local_file with open(path.join(here, filename)) as fp: IOError: [Errno 2] No such file or directory: '/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/saml-response-expired-before-valid.xml' ====================================================================== ERROR: test_invalid_saml_too_late (aws_google_auth.tests.test_amazon.TestAmazon) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_amazon.py", line 57, in test_invalid_saml_too_late saml_xml = self.read_local_file('saml-response-too-late.xml') File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_amazon.py", line 24, in read_local_file with open(path.join(here, filename)) as fp: IOError: [Errno 2] No such file or directory: '/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/saml-response-too-late.xml' ====================================================================== ERROR: test_invalid_saml_too_soon (aws_google_auth.tests.test_amazon.TestAmazon) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_amazon.py", line 53, in test_invalid_saml_too_soon saml_xml = self.read_local_file('saml-response-too-soon.xml') File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_amazon.py", line 24, in read_local_file with open(path.join(here, filename)) as fp: IOError: [Errno 2] No such file or directory: '/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/saml-response-too-soon.xml' ====================================================================== ERROR: test_role_extraction (aws_google_auth.tests.test_amazon.TestAmazon) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_amazon.py", line 32, in test_role_extraction saml_xml = self.read_local_file('valid-response.xml') File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_amazon.py", line 24, in read_local_file with open(path.join(here, filename)) as fp: IOError: [Errno 2] No such file or directory: '/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/valid-response.xml' ====================================================================== ERROR: test_role_extraction_too_many_commas (aws_google_auth.tests.test_amazon.TestAmazon) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_amazon.py", line 43, in test_role_extraction_too_many_commas saml_xml = self.read_local_file('too-many-commas.xml') File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_amazon.py", line 24, in read_local_file with open(pa th.join(here, filename)) as fp: IOError: [Errno 2] No such file or directory: '/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/too-many-commas.xml' ====================================================================== ERROR: test_valid_saml (aws_google_auth.tests.test_amazon.TestAmazon) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_amazon.py", line 72, in test_valid_saml saml_xml = self.read_local_file('saml-response-no-expire.xml') File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_amazon.py", line 24, in read_local_file with open(path.join(here, filename)) as fp: IOError: [Errno 2] No such file or directory: '/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/saml-response-no-expire.xml' ====================================================================== ERROR: test_extra_step (aws_google_auth.tests.test_google.TestGoogle) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_google.py", line 18, in test_extra_step response = self.read_local_file('google_error.html') File "/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/test_google.py", line 14, in read_local_file with open(path.join(here, filename), encoding='utf8') as fp: IOError: [Errno 2] No such file or directory: '/tmp/nix-build-aws-google-auth-0.0.29.drv-0/aws-google-auth-0.0.29/aws_google_auth/tests/google_error.html' ---------------------------------------------------------------------- Ran 96 tests in 2.664s FAILED (errors=7) Test failed: ```
stevemac007 commented 5 years ago

Is it normal to include the tests and the test data files in the tarball?

I assume we can include the test data - but I would have expected that to be executed as part of the build process to validate the artefact.

Can you point at anything that explains what is needed to change to work with your expected process?

1oglop1 commented 4 years ago

@stevemac007 @marsam I'm a bit late for the party but, It is a quite common practice to include tests in your package, however including tests in a PyPi package can be tricky especially if you are not using src directory because as per this article https://blog.ionelmc.ro/2014/05/25/python-packaging/. Test module can often cause various problems. e.g. shadowing another test module or so.

When you follow the advice in the article and introduce scr structure, you can then include your tests in your package the same way as it's done here: https://github.com/ionelmc/cookiecutter-pylibrary/blob/master/%7B%7Bcookiecutter.repo_name%7D%7D/MANIFEST.in

I will leave the final decision at you @stevemac007 whether you'd like to change the project structure or just close this issue as won't fix instead of keeping it open forever. :)

stevemac007 commented 4 years ago

Thanks for the update @1oglop1 - I'm always open to making things more flexible and usable - will look into how to support this when I have a little more time on my hands.