Skip to content

Commit 5ae5fef

Browse files
Merge pull request #1306 from sandeepbarnwal/fix/intermittent-test-errors
fixes intermittent test errors occrued due to lagcy token usage
2 parents bef9d74 + faf9ffe commit 5ae5fef

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,5 @@ bazel-*
145145

146146
.DS_Store
147147
.idea/*
148+
test-results
149+
.local

tests/test_runners/test_codeceptjs.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
from smart_tests.utils.http_client import get_base_url
1010
from tests.cli_test_case import CliTestCase
1111

12+
_TOKEN = {"SMART_TESTS_TOKEN": CliTestCase.smart_tests_token}
13+
1214

1315
class CodeceptjsTest(CliTestCase):
1416
@responses.activate
15-
@mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.smart_tests_token})
17+
@mock.patch.dict(os.environ, _TOKEN)
1618
def test_record_test_codeceptjs(self):
1719
result = self.cli(
1820
"record",
@@ -27,7 +29,7 @@ def test_record_test_codeceptjs(self):
2729
self.assert_record_tests_payload("record_test_result.json")
2830

2931
@responses.activate
30-
@mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.smart_tests_token})
32+
@mock.patch.dict(os.environ, _TOKEN)
3133
def test_subset(self):
3234
"""Test basic subset functionality with multiple test files"""
3335
pipe = "test/example_test.js\ntest/login_test.js\n"
@@ -70,7 +72,7 @@ def test_subset(self):
7072
)
7173

7274
@responses.activate
73-
@mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.smart_tests_token})
75+
@mock.patch.dict(os.environ, _TOKEN)
7476
def test_subset_with_rest(self):
7577
"""Test subset functionality with --rest option to save remaining tests"""
7678
pipe = "test/example_test.js\ntest/other_test.js\n"
@@ -132,7 +134,7 @@ def test_subset_with_rest(self):
132134
Path(rest_file_path).unlink()
133135

134136
@responses.activate
135-
@mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.smart_tests_token})
137+
@mock.patch.dict(os.environ, _TOKEN)
136138
def test_subset_with_single_test(self):
137139
"""Test subset functionality with a single test file"""
138140
pipe = "test/single_test.js\n"
@@ -172,7 +174,7 @@ def test_subset_with_single_test(self):
172174
self.assertEqual(output_json["tests"], ["test/single_test.js"])
173175

174176
@responses.activate
175-
@mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.smart_tests_token})
177+
@mock.patch.dict(os.environ, _TOKEN)
176178
def test_subset_strips_newlines(self):
177179
"""Test that subset properly strips newlines from test paths"""
178180
# Test with various newline formats

0 commit comments

Comments
 (0)