From 4642ddc020b66df2fd6afb900e576e2a73170238 Mon Sep 17 00:00:00 2001 From: Cas Wognum Date: Sun, 2 Feb 2025 13:43:39 -0500 Subject: [PATCH 1/5] Add new test case for login flow Expect this to fail on Windows --- tests/test_hub_integration.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_hub_integration.py b/tests/test_hub_integration.py index 9f52a030..a7c5c50a 100644 --- a/tests/test_hub_integration.py +++ b/tests/test_hub_integration.py @@ -3,6 +3,7 @@ import polaris as po from polaris.benchmark._base import BenchmarkSpecification from polaris.dataset._base import BaseDataset +from polaris.hub.client import PolarisHubClient from polaris.hub.settings import PolarisHubSettings settings = PolarisHubSettings() @@ -24,3 +25,12 @@ def test_load_dataset_flow(): def test_load_benchmark_flow(): benchmark = po.load_benchmark("polaris/hello-world-benchmark") assert isinstance(benchmark, BenchmarkSpecification) + + +@pytest.mark.skipif( + settings.username is None or settings.password is None, + reason="This test case requires headless authentication to be set up", +) +def test_login_flow(): + with PolarisHubClient() as client: + client.login() From 0f3b6989858163603dde555c13ea9c5b82a6c775 Mon Sep 17 00:00:00 2001 From: Cas Wognum Date: Sun, 2 Feb 2025 13:51:35 -0500 Subject: [PATCH 2/5] Try break the CICD on Windows --- polaris/hub/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polaris/hub/client.py b/polaris/hub/client.py index 52f2e6a5..fb22b494 100644 --- a/polaris/hub/client.py +++ b/polaris/hub/client.py @@ -249,7 +249,7 @@ def login(self, overwrite: bool = False, auto_open_browser: bool = True): self.external_client.interactive_login(overwrite=overwrite, auto_open_browser=auto_open_browser) self.token = self.fetch_token() - logger.info("You are successfully logged in to the Polaris Hub.") + logger.info("You are successfully logged in to the Polaris Hub. 🎉 :tada:") # ========================= # API Endpoints From e4a3f385901bc9bd4ae7b8b00cf033284c15b452 Mon Sep 17 00:00:00 2001 From: Cas Wognum Date: Sun, 2 Feb 2025 14:00:37 -0500 Subject: [PATCH 3/5] Removed emoji --- polaris/hub/client.py | 2 +- polaris/hub/external_client.py | 2 +- tests/test_hub_integration.py | 10 ---------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/polaris/hub/client.py b/polaris/hub/client.py index fb22b494..52f2e6a5 100644 --- a/polaris/hub/client.py +++ b/polaris/hub/client.py @@ -249,7 +249,7 @@ def login(self, overwrite: bool = False, auto_open_browser: bool = True): self.external_client.interactive_login(overwrite=overwrite, auto_open_browser=auto_open_browser) self.token = self.fetch_token() - logger.info("You are successfully logged in to the Polaris Hub. 🎉 :tada:") + logger.info("You are successfully logged in to the Polaris Hub.") # ========================= # API Endpoints diff --git a/polaris/hub/external_client.py b/polaris/hub/external_client.py index 30f191ff..49098313 100644 --- a/polaris/hub/external_client.py +++ b/polaris/hub/external_client.py @@ -157,4 +157,4 @@ def interactive_login(self, overwrite: bool = False, auto_open_browser: bool = T # Step 3: Exchange authorization code for an access token self.fetch_token(code=authorization_code, grant_type="authorization_code") - logger.info(f"Successfully authenticated to the Polaris Hub as `{self.user_info['email']}`! 🎉") + logger.info(f"Successfully authenticated to the Polaris Hub as `{self.user_info['email']}`!") diff --git a/tests/test_hub_integration.py b/tests/test_hub_integration.py index a7c5c50a..9f52a030 100644 --- a/tests/test_hub_integration.py +++ b/tests/test_hub_integration.py @@ -3,7 +3,6 @@ import polaris as po from polaris.benchmark._base import BenchmarkSpecification from polaris.dataset._base import BaseDataset -from polaris.hub.client import PolarisHubClient from polaris.hub.settings import PolarisHubSettings settings = PolarisHubSettings() @@ -25,12 +24,3 @@ def test_load_dataset_flow(): def test_load_benchmark_flow(): benchmark = po.load_benchmark("polaris/hello-world-benchmark") assert isinstance(benchmark, BenchmarkSpecification) - - -@pytest.mark.skipif( - settings.username is None or settings.password is None, - reason="This test case requires headless authentication to be set up", -) -def test_login_flow(): - with PolarisHubClient() as client: - client.login() From 973a627d872492c8c49db9f4f22cce2f1fe59cec Mon Sep 17 00:00:00 2001 From: Cas Wognum Date: Sun, 2 Feb 2025 14:04:40 -0500 Subject: [PATCH 4/5] Add very explicit tests --- tests/test_logging.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/test_logging.py diff --git a/tests/test_logging.py b/tests/test_logging.py new file mode 100644 index 00000000..9584961c --- /dev/null +++ b/tests/test_logging.py @@ -0,0 +1,11 @@ +import logging + +logger = logging.getLogger(__name__) + + +def test_emoji(): + logger.info("🎉") + + +def test_emoji_via_shortcode(): + logger.info(":tada:") From 2737b66c72d7daf67ee7e2062d2c0316c611efe7 Mon Sep 17 00:00:00 2001 From: Cas Wognum Date: Sun, 2 Feb 2025 14:09:55 -0500 Subject: [PATCH 5/5] Removed test case again --- tests/test_logging.py | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 tests/test_logging.py diff --git a/tests/test_logging.py b/tests/test_logging.py deleted file mode 100644 index 9584961c..00000000 --- a/tests/test_logging.py +++ /dev/null @@ -1,11 +0,0 @@ -import logging - -logger = logging.getLogger(__name__) - - -def test_emoji(): - logger.info("🎉") - - -def test_emoji_via_shortcode(): - logger.info(":tada:")