prjemian / punx

Python Utilities for NeXus HDF5 files
https://prjemian.github.io/punx
5 stars 7 forks source link

Unit test for GitHub token fails when specific file name is provided #156

Closed prjemian closed 2 years ago

prjemian commented 2 years ago

In #151, the code looks in more places for GitHub credentials. Now, a unit test fails.

====================================================================== FAILURES ======================================================================
____________________________________________________________ test_GitHub_credentials_none ____________________________________________________________

    def test_GitHub_credentials_none():
        token = github_handler.get_GitHub_credentials("This file does not exist.",)
>       assert token is None
E       AssertionError: assert 'the_local_github_token_here' is None

punx/tests/test_github_handler.py:144: AssertionError
============================================================== short test summary info ===============================================================
FAILED punx/tests/test_github_handler.py::test_GitHub_credentials_none - AssertionError: assert 'the_local_github_token_here' is None
=========================================================== 1 failed, 85 passed in 28.60s ============================================================

In this case, github_handler.get_GitHub_credentials() returns the token since it is found in an alternative. But the test specifies a file for the token and expects no token to be turned.

Either revise github_handler.get_GitHub_credentials() (to only look in the provided file if that is defined) or remove the unit test.

prjemian commented 2 years ago

Will first try to revise the search code and leave the test as-is.