prjemian / punx

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

unit test fails: #137

Closed prjemian closed 2 years ago

prjemian commented 2 years ago

unit tests in tests/github_handler_test.py::Test_Github_Handler_Module fail, both in GitHub workflow and locally:

```bash (bluesky_2021_2) prjemian@zap:~/.../prjemian/punx$ pytest -vvv --ignore=./tests/ignore_now . ================================================================ test session starts ================================================================= platform linux -- Python 3.8.10, pytest-6.2.3, py-1.10.0, pluggy-0.13.1 -- /home/prjemian/.conda/envs/bluesky_2021_2/bin/python cachedir: .pytest_cache rootdir: /home/prjemian/Documents/projects/prjemian/punx plugins: anyio-2.2.0 collected 82 items tests/cache_manager_test.py::Test_CacheManager_class::test_basic_setup PASSED [ 1%] tests/cache_manager_test.py::Test_CacheManager_class::test_instance PASSED [ 2%] tests/cache_manager_test.py::Test_CacheManager_class::test_missing_file_set PASSED [ 3%] tests/cache_manager_test.py::Test_CacheManager_class::test_selected_file_set PASSED [ 4%] tests/cache_manager_test.py::Test_NXDL_File_Set_class::test_class PASSED [ 6%] tests/cache_manager_test.py::Test_NXDL_File_Set_class::test_class_raw PASSED [ 7%] tests/common_test.py::TestCommon::test_create_test_file PASSED [ 8%] tests/common_test.py::TestCommon::test_get_test_file PASSED [ 9%] tests/common_test.py::TestCommon::test_hdf5_file_with_simple_content PASSED [ 10%] tests/common_test.py::TestCommon::test_is_hdf5_file PASSED [ 12%] tests/common_test.py::TestCommon::test_is_not_hdf5_file PASSED [ 13%] tests/common_test.py::TestCommon::test_punx_data_file_name PASSED [ 14%] tests/common_test.py::TestCommon::test_read_filelines PASSED [ 15%] tests/finding_test.py::Test_ValidationResultStatus::test_standard PASSED [ 17%] tests/finding_test.py::Test_Finding::test_exception PASSED [ 18%] tests/finding_test.py::Test_Finding::test_standard PASSED [ 19%] tests/finding_test.py::Test_Finding::test_str PASSED [ 20%] tests/finding_test.py::Test_Global::test_standard PASSED [ 21%] tests/github_handler_test.py::Test_Github_Handler_Module::test_GitHub_credentials_file PASSED [ 23%] tests/github_handler_test.py::Test_Github_Handler_Module::test_GitHub_credentials_none PASSED [ 24%] tests/github_handler_test.py::Test_Github_Handler_Module::test_Github_download_default FAILED [ 25%] tests/github_handler_test.py::Test_Github_Handler_Module::test_basic_setup PASSED [ 26%] tests/github_handler_test.py::Test_Github_Handler_Module::test_class_GitHub_Repository_Reference PASSED [ 28%] tests/github_handler_test.py::Test_Github_Handler_Module::test_connected_GitHub_Repository_Reference FAILED [ 29%] tests/h5tree_test.py::Test_Battery::test_h5tree PASSED [ 30%] tests/nxdl_manager_test.py::Test_XML_functions::test_nxdl_definition__invalid PASSED [ 31%] tests/nxdl_manager_test.py::Test_XML_functions::test_xml_validation__invalid PASSED [ 32%] tests/nxdl_manager_test.py::Test_XML_functions::test_xml_validation__valid PASSED [ 34%] tests/nxdl_manager_test.py::Test_get_NXDL_file_list::test__FileNotFound PASSED [ 35%] tests/nxdl_manager_test.py::Test_get_NXDL_file_list::test__IOError PASSED [ 36%] tests/nxdl_manager_test.py::Test_get_NXDL_file_list::test__function PASSED [ 37%] tests/nxdl_manager_test.py::Test_NXDL_Manager::test__FileNotFound PASSED [ 39%] tests/nxdl_manager_test.py::Test_NXDL_Manager::test__function PASSED [ 40%] tests/nxdl_manager_test.py::Test_NXDL_Manager::test_expected_attributes PASSED [ 41%] tests/nxdl_schema_test.py::Test_Functions::test_get_named_parent_node PASSED [ 42%] tests/nxdl_schema_test.py::Test_Functions::test_get_reference_keys PASSED [ 43%] tests/nxdl_schema_test.py::Test_Functions::test_namespace_dictionary PASSED [ 45%] tests/nxdl_schema_test.py::Test_Functions::test_render_class_str PASSED [ 46%] tests/nxdl_schema_test.py::Test_Catalog::test_NXDL_item_catalog_creation PASSED [ 47%] tests/nxdl_schema_test.py::Test_Catalog::test_NXDL_item_catalog_issue_67_main PASSED [ 48%] tests/nxdl_schema_test.py::Test_Catalog::test_NXDL_summary PASSED [ 50%] tests/schema_manager_test.py::Test_SchemaManager_Module::test_SchemaManager_class PASSED [ 51%] tests/schema_manager_test.py::Test_SchemaManager_Module::test_raise_error_function PASSED [ 52%] tests/schema_manager_test.py::Test_SchemaManager_Module::test_strip_ns_function PASSED [ 53%] tests/schema_manager_test.py::Test_get_default_schema_manager::test__function PASSED [ 54%] tests/utils_test.py::Test_decode_byte_string::test_byte_string PASSED [ 56%] tests/utils_test.py::Test_decode_byte_string::test_numpy_bytes_ PASSED [ 57%] tests/utils_test.py::Test_decode_byte_string::test_numpy_ndarray PASSED [ 58%] tests/utils_test.py::Test_HDF5_Tests::test_isHdf5Dataset PASSED [ 59%] tests/utils_test.py::Test_HDF5_Tests::test_isHdf5ExternalLink PASSED [ 60%] tests/utils_test.py::Test_HDF5_Tests::test_isHdf5FileObject PASSED [ 62%] tests/utils_test.py::Test_HDF5_Tests::test_isHdf5Group PASSED [ 63%] tests/utils_test.py::Test_HDF5_Tests::test_isHdf5Link PASSED [ 64%] tests/validate_test.py::Test_Constructor_Exceptions::test_bad_file_name_detected PASSED [ 65%] tests/validate_test.py::Test_Constructor_Exceptions::test_bad_file_set_reference PASSED [ 67%] tests/validate_test.py::Test_Constructor_Exceptions::test_not_HDF5_file_detected PASSED [ 68%] tests/validate_test.py::Test_Constructor::test_valid_hdf5_file_constructed PASSED [ 69%] tests/validate_test.py::Test_Constructor::test_valid_nexus_file_constructed PASSED [ 70%] tests/validate_test.py::Test_Changing_NXDL_Rules::test_NXdata_requirement_or_optional PASSED [ 71%] tests/validate_test.py::Test_Validate::test_application_definition PASSED [ 73%] tests/validate_test.py::Test_Validate::test_axes_attribute_1D__pass PASSED [ 74%] tests/validate_test.py::Test_Validate::test_axes_attribute_2D__fail PASSED [ 75%] tests/validate_test.py::Test_Validate::test_axes_attribute_2D__pass PASSED [ 76%] tests/validate_test.py::Test_Validate::test_bad_link_target_value PASSED [ 78%] tests/validate_test.py::Test_Validate::test_contributed_application_definition PASSED [ 79%] tests/validate_test.py::Test_Validate::test_contributed_base_class PASSED [ 80%] tests/validate_test.py::Test_Validate::test_item_names PASSED [ 81%] tests/validate_test.py::Test_Validate::test_non_nexus_group PASSED [ 82%] tests/validate_test.py::Test_Validate::test_proper_classpath_determined PASSED [ 84%] tests/validate_test.py::Test_Validate::test_specific_hdf5_addresses_can_be_found PASSED [ 85%] tests/validate_test.py::Test_Validate::test_writer_1_3 PASSED [ 86%] tests/validate_test.py::Test_Validate::test_writer_2_1 PASSED [ 87%] tests/validate_test.py::Test_Validate::test_wrong_link_target_value PASSED [ 89%] tests/validate_test.py::Test_Default_Plot::test_default_plot_v1_fail PASSED [ 90%] tests/validate_test.py::Test_Default_Plot::test_default_plot_v1_pass PASSED [ 91%] tests/validate_test.py::Test_Default_Plot::test_default_plot_v2_fail_multi_signal PASSED [ 92%] tests/validate_test.py::Test_Default_Plot::test_default_plot_v2_fail_no_signal PASSED [ 93%] tests/validate_test.py::Test_Default_Plot::test_default_plot_v2_pass PASSED [ 95%] tests/validate_test.py::Test_Default_Plot::test_default_plot_v3_fail PASSED [ 96%] tests/validate_test.py::Test_Default_Plot::test_default_plot_v3_pass PASSED [ 97%] tests/validate_test.py::Test_Default_Plot::test_default_plot_v3_pass_multi PASSED [ 98%] tests/validate_test.py::Test_Example_data::test_Data_Q PASSED [100%] ====================================================================== FAILURES ====================================================================== ______________________________________________ Test_Github_Handler_Module.test_Github_download_default _______________________________________________ self = def test_Github_download_default(self): import punx.cache_manager grr = punx.github_handler.GitHub_Repository_Reference() > using_creds = grr.connect_repo() tests/github_handler_test.py:155: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ src/punx/github_handler.py:126: in connect_repo self.repo = gh.get_repo(repo_name) ../../../../.conda/envs/bluesky_2021_2/lib/python3.8/site-packages/github/MainClass.py:330: in get_repo headers, data = self.__requester.requestJsonAndCheck("GET", url) ../../../../.conda/envs/bluesky_2021_2/lib/python3.8/site-packages/github/Requester.py:353: in requestJsonAndCheck return self.__check( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , status = 404 responseHeaders = {'access-control-allow-origin': '*', 'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP...s, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset', 'content-encoding': 'gzip', 'content-length': '91', ...} output = {'documentation_url': 'https://docs.github.com/rest', 'message': 'Not Found'} def __check(self, status, responseHeaders, output): output = self.__structuredFromJson(output) if status >= 400: > raise self.__createException(status, responseHeaders, output) E github.GithubException.UnknownObjectException: 404 {"message": "Not Found", "documentation_url": "https://docs.github.com/rest"} ../../../../.conda/envs/bluesky_2021_2/lib/python3.8/site-packages/github/Requester.py:378: UnknownObjectException _______________________________________ Test_Github_Handler_Module.test_connected_GitHub_Repository_Reference ________________________________________ self = def test_connected_GitHub_Repository_Reference(self): grr = punx.github_handler.GitHub_Repository_Reference() > using_creds = grr.connect_repo() tests/github_handler_test.py:73: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ src/punx/github_handler.py:126: in connect_repo self.repo = gh.get_repo(repo_name) ../../../../.conda/envs/bluesky_2021_2/lib/python3.8/site-packages/github/MainClass.py:330: in get_repo headers, data = self.__requester.requestJsonAndCheck("GET", url) ../../../../.conda/envs/bluesky_2021_2/lib/python3.8/site-packages/github/Requester.py:353: in requestJsonAndCheck return self.__check( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , status = 404 responseHeaders = {'access-control-allow-origin': '*', 'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP...s, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset', 'content-encoding': 'gzip', 'content-length': '91', ...} output = {'documentation_url': 'https://docs.github.com/rest', 'message': 'Not Found'} def __check(self, status, responseHeaders, output): output = self.__structuredFromJson(output) if status >= 400: > raise self.__createException(status, responseHeaders, output) E github.GithubException.UnknownObjectException: 404 {"message": "Not Found", "documentation_url": "https://docs.github.com/rest"} ../../../../.conda/envs/bluesky_2021_2/lib/python3.8/site-packages/github/Requester.py:378: UnknownObjectException ============================================================== short test summary info =============================================================== FAILED tests/github_handler_test.py::Test_Github_Handler_Module::test_Github_download_default - github.GithubException.UnknownObjectException: 404 ... FAILED tests/github_handler_test.py::Test_Github_Handler_Module::test_connected_GitHub_Repository_Reference - github.GithubException.UnknownObjectE... ```
prjemian commented 2 years ago

This might be the credentials (again). See #134 for most recent work on creds handling. Might consider #111 in this branch.