Skip to content

Commit 058cc51

Browse files
committed
fix test
1 parent ff4046f commit 058cc51

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

smart_tests/commands/record/attachment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def attachment(
5353
if zip_info.is_dir():
5454
continue
5555

56-
if not matches_include_patterns(zip_info.filename, include_patterns):
56+
if not matches_include_patterns(zip_info.filename, tuple(include_patterns)):
5757
continue
5858

5959
file_content = zip_file.read(zip_info.filename)
@@ -80,7 +80,7 @@ def attachment(
8080
if tar_info.isdir():
8181
continue
8282

83-
if not matches_include_patterns(tar_info.name, include_patterns):
83+
if not matches_include_patterns(tar_info.name, tuple(include_patterns)):
8484
continue
8585

8686
file_obj = tar_file.extractfile(tar_info)

smart_tests/test_runners/maven.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,15 @@ def record_tests(
169169
)],
170170
):
171171
client.path_builder = junit5_nested_class_path_builder(client.path_builder)
172+
173+
# Override report method to filter out non-JUnit report files
172174
original_report = client.report
175+
173176
IGNORED_FILES = {'failsafe-summary.xml', 'testng-results.xml'}
174177

175178
def report_with_filter(junit_report_file: str):
176179
if not any(junit_report_file.endswith(f) for f in IGNORED_FILES):
177180
original_report(junit_report_file)
178181

179-
client.report = report_with_filter
182+
client.report = report_with_filter # type: ignore[method-assign]
180183
smart_tests.CommonRecordTestImpls.load_report_files(client=client, source_roots=reports)

tests/commands/record/test_attachment.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import responses # type: ignore
99

10-
from build.lib.smart_tests.utils.session import write_session
1110
from smart_tests.utils.http_client import get_base_url
1211
from tests.cli_test_case import CliTestCase
1312

@@ -161,7 +160,7 @@ def test_attachment_with_include_filter(self):
161160
self.assertEqual(expect, result.output)
162161

163162
@responses.activate
164-
@mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.launchable_token})
163+
@mock.patch.dict(os.environ, {"SMART_TESTS_TOKEN": CliTestCase.smart_tests_token})
165164
def test_attachment_with_identical_file_names(self):
166165
with tempfile.TemporaryDirectory() as temp_dir:
167166
# Create temporary files
@@ -216,13 +215,10 @@ def test_attachment_with_identical_file_names(self):
216215
self.assertEqual(expect, result.output)
217216

218217
@responses.activate
219-
@mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.launchable_token})
218+
@mock.patch.dict(os.environ, {"SMART_TESTS_TOKEN": CliTestCase.smart_tests_token})
220219
def test_attachment_with_whitespace_in_filename(self):
221220
TEST_CONTENT = b"Test log content"
222221

223-
# emulate launchable record build & session
224-
write_session(self.build_name, self.session_id)
225-
226222
# Create a file with whitespace in the name
227223
with tempfile.TemporaryDirectory() as temp_dir:
228224
file_path = os.path.join(temp_dir, "app log file.txt")
@@ -245,7 +241,7 @@ def test_attachment_with_whitespace_in_filename(self):
245241
self.assertIn("✓ Recorded successfully", result.output)
246242

247243
@responses.activate
248-
@mock.patch.dict(os.environ, {"LAUNCHABLE_TOKEN": CliTestCase.launchable_token})
244+
@mock.patch.dict(os.environ, {"SMART_TESTS_TOKEN": CliTestCase.smart_tests_token})
249245
def test_attachment_duplicate_file_paths(self):
250246
with tempfile.TemporaryDirectory() as temp_dir:
251247
# Create temporary files

0 commit comments

Comments
 (0)