From faf9ffe5ae629e2c3e12b113914d0b91be74d4e5 Mon Sep 17 00:00:00 2001 From: Sandeep Kumar Barnwal Date: Thu, 28 May 2026 13:23:59 +0530 Subject: [PATCH] fixes intermittent test errors occrued due to lagcy token usage --- .gitignore | 2 ++ tests/test_runners/test_codeceptjs.py | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 5a661aedc..563cd274c 100644 --- a/.gitignore +++ b/.gitignore @@ -145,3 +145,5 @@ bazel-* .DS_Store .idea/* +test-results +.local diff --git a/tests/test_runners/test_codeceptjs.py b/tests/test_runners/test_codeceptjs.py index a5410b935..4fb7f0d9c 100644 --- a/tests/test_runners/test_codeceptjs.py +++ b/tests/test_runners/test_codeceptjs.py @@ -9,10 +9,12 @@ from smart_tests.utils.http_client import get_base_url from tests.cli_test_case import CliTestCase +_TOKEN = {"SMART_TESTS_TOKEN": CliTestCase.smart_tests_token} + class CodeceptjsTest(CliTestCase): @responses.activate - @mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.smart_tests_token}) + @mock.patch.dict(os.environ, _TOKEN) def test_record_test_codeceptjs(self): result = self.cli( "record", @@ -27,7 +29,7 @@ def test_record_test_codeceptjs(self): self.assert_record_tests_payload("record_test_result.json") @responses.activate - @mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.smart_tests_token}) + @mock.patch.dict(os.environ, _TOKEN) def test_subset(self): """Test basic subset functionality with multiple test files""" pipe = "test/example_test.js\ntest/login_test.js\n" @@ -70,7 +72,7 @@ def test_subset(self): ) @responses.activate - @mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.smart_tests_token}) + @mock.patch.dict(os.environ, _TOKEN) def test_subset_with_rest(self): """Test subset functionality with --rest option to save remaining tests""" pipe = "test/example_test.js\ntest/other_test.js\n" @@ -132,7 +134,7 @@ def test_subset_with_rest(self): Path(rest_file_path).unlink() @responses.activate - @mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.smart_tests_token}) + @mock.patch.dict(os.environ, _TOKEN) def test_subset_with_single_test(self): """Test subset functionality with a single test file""" pipe = "test/single_test.js\n" @@ -172,7 +174,7 @@ def test_subset_with_single_test(self): self.assertEqual(output_json["tests"], ["test/single_test.js"]) @responses.activate - @mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.smart_tests_token}) + @mock.patch.dict(os.environ, _TOKEN) def test_subset_strips_newlines(self): """Test that subset properly strips newlines from test paths""" # Test with various newline formats