diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index edd93a7b..aaf6bf8c 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -26,8 +26,8 @@ def authenticated_store(): # we need to use a valid EDL credential - assert "EARTHDATA_USERNAME" in os.environ is True - assert "EARTHDATA_PASSWORD" in os.environ is True + assert "EARTHDATA_USERNAME" in os.environ + assert "EARTHDATA_PASSWORD" in os.environ auth = Auth().login(strategy="environment") assert auth.authenticated is True diff --git a/tests/integration/test_api.py b/tests/integration/test_api.py index 8fd45489..5264bf50 100644 --- a/tests/integration/test_api.py +++ b/tests/integration/test_api.py @@ -11,8 +11,8 @@ assertions = unittest.TestCase("__init__") -assertions.assertTrue("EARTHDATA_USERNAME" in os.environ) -assertions.assertTrue("EARTHDATA_PASSWORD" in os.environ) +assert "EARTHDATA_USERNAME" in os.environ +assert "EARTHDATA_PASSWORD" in os.environ logger.info(f"Current username: {os.environ['EARTHDATA_USERNAME']}") logger.info(f"earthaccess version: {earthaccess.__version__}") @@ -46,13 +46,13 @@ def test_auth_returns_valid_auth_class(): auth = earthaccess.login(strategy="environment") assertions.assertIsInstance(auth, earthaccess.Auth) assertions.assertIsInstance(earthaccess.__auth__, earthaccess.Auth) - assertions.assertTrue(earthaccess.__auth__.authenticated) + assert earthaccess.__auth__.authenticated is True def test_dataset_search_returns_none_with_no_parameters(): results = earthaccess.search_datasets() assertions.assertIsInstance(results, list) - assertions.assertTrue(len(results) == 0) + assert (len(results) == 0) is True @pytest.mark.parametrize("kwargs", dataset_valid_params) @@ -66,7 +66,7 @@ def test_dataset_search_returns_valid_results(kwargs): def test_granules_search_returns_valid_results(kwargs): results = earthaccess.search_data(count=10, **kwargs) assertions.assertIsInstance(results, list) - assertions.assertTrue(len(results) <= 10) + assert (len(results) <= 10) is True @pytest.mark.parametrize("selection", [0, slice(None)]) diff --git a/tests/integration/test_auth.py b/tests/integration/test_auth.py index aef60299..c02a228f 100644 --- a/tests/integration/test_auth.py +++ b/tests/integration/test_auth.py @@ -82,7 +82,7 @@ def test_auth_can_create_authenticated_requests_sessions(): def test_auth_can_fetch_s3_credentials(): activate_environment() auth = earthaccess.login(strategy="environment") - assertions.assertTrue(auth.authenticated) + assert auth.authenticated is True for daac in earthaccess.daac.DAACS: if len(daac["s3-credentials"]) > 0: try: diff --git a/tests/integration/test_cloud_open.py b/tests/integration/test_cloud_open.py index 542b915b..001ddfc5 100644 --- a/tests/integration/test_cloud_open.py +++ b/tests/integration/test_cloud_open.py @@ -106,7 +106,7 @@ def test_earthaccess_can_open_onprem_collection_granules( # We are testing this method fileset = store.open(granules_to_open) - assertions.assertTrue(isinstance(fileset, list)) + assert isinstance(fileset, list) is True # we test that we can read some bytes and get the file type for file in fileset: diff --git a/tests/integration/test_onprem_download.py b/tests/integration/test_onprem_download.py index 7c4c6157..3fead82f 100644 --- a/tests/integration/test_onprem_download.py +++ b/tests/integration/test_onprem_download.py @@ -99,11 +99,11 @@ def test_earthaccess_can_download_onprem_collection_granules( # We are testing this method downloaded_results = store.get(granules_to_download, local_path=local_path) - assertions.assertTrue(isinstance(downloaded_results, list)) - assertions.assertTrue(len(downloaded_results) == granules_sample_size) + assert isinstance(downloaded_results, list) is True + assert (len(downloaded_results) == granules_sample_size) is True path = Path(local_path) - assertions.assertTrue(path.is_dir()) + assert path.is_dir() is True # test that we downloaded the mb reported by CMR total_mb_downloaded = round( (sum(file.stat().st_size for file in path.rglob("*")) / 1024**2), 2 diff --git a/tests/integration/test_onprem_open.py b/tests/integration/test_onprem_open.py index 9e84870e..e1621266 100644 --- a/tests/integration/test_onprem_open.py +++ b/tests/integration/test_onprem_open.py @@ -77,7 +77,7 @@ def test_earthaccess_can_open_onprem_collection_granules( total_granules = granule_query.hits() granules = granule_query.get(granules_count) assertions.assertTrue(len(granules) > 0, "Could not fetch granules") - assertions.assertTrue(isinstance(granules[0], earthaccess.results.DataGranule)) + assert isinstance(granules[0], earthaccess.results.DataGranule) is True data_links = granules[0].data_links() if not supported_collection(data_links): logger.warning(f"PODAAC DRIVE is not supported at the moment: {data_links}") @@ -98,7 +98,7 @@ def test_earthaccess_can_open_onprem_collection_granules( # We are testing this method fileset = store.open(granules_to_open) - assertions.assertTrue(isinstance(fileset, list)) + assert isinstance(fileset, list) is True # we test that we can read some bytes and get the file type for file in fileset: