diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 156ac20..34761cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: run: | python setup.py install cd ~ - python -Wa -m pytest --pyargs crystals + python -Wa -m pytest --pyargs crystals --full-trace - name: Build documentation run: | diff --git a/crystals/atom_data.py b/crystals/atom_data.py index 674a773..2ead4d8 100644 --- a/crystals/atom_data.py +++ b/crystals/atom_data.py @@ -517,6 +517,8 @@ # from Cordero et al, 'Covalent radii revisited' (2008). # Dalton Transactions. DOI: 10.1039/B801115J +# TODO: implement bond perception based on something like this: +# https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3557220/ covalent_radii = { "H": 0.31, "He": 0.28, diff --git a/crystals/parsers.py b/crystals/parsers.py index 7c3e116..dc059d1 100644 --- a/crystals/parsers.py +++ b/crystals/parsers.py @@ -939,7 +939,12 @@ def download_cif(self, api_key, query, download_dir, overwrite=False): } with requests.get(endpoint, headers=headers) as response: - if response.status_code != 200: + if response.status_code == 403: # Forbidden access + raise ConnectionError( + "Materials Project API key is not authorized to do this operation." + / f"status code {response.status_code}" + ) + elif response.status_code != 200: raise ConnectionError( f"Would not connect: status code {response.status_code}" ) diff --git a/crystals/tests/test_parsers.py b/crystals/tests/test_parsers.py index 0a47945..f4cf3de 100644 --- a/crystals/tests/test_parsers.py +++ b/crystals/tests/test_parsers.py @@ -25,7 +25,7 @@ else: WITH_BIOPYTHON = True -# API key to test Materails Project-related things +# API key to test Materials Project-related things MPJ_API_KEY = os.environ.get("MATERIALS_PROJECT_API_KEY", None) CIF_FILES = [Crystal.from_database(name).source for name in Crystal.builtins] @@ -201,7 +201,7 @@ def test_cif_site_occupancy(): for atm in filter(is_element("C"), atoms): assert atm.occupancy == 0.85 - +@pytest.mark.xfail(reason="Bad SSL certificates") @pytest.mark.skipif( MPJ_API_KEY is None, reason="Materials Project API key not defined in the environment.", @@ -218,7 +218,7 @@ def test_mpj_example(): ) assert isinstance(cryst, Crystal) - +@pytest.mark.xfail(reason="Bad SSL certificates") @pytest.mark.skipif( MPJ_API_KEY is None, reason="Materials Project API key not defined in the environment.",