Skip to content

Commit 0d4fc83

Browse files
committed
Fix issue with long filenames in logs
1 parent fda7a28 commit 0d4fc83

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14217,13 +14217,18 @@ def __get_test_id(self):
1421714217
)
1421814218
if self._sb_test_identifier and len(str(self._sb_test_identifier)) > 6:
1421914219
test_id = self._sb_test_identifier
14220-
test_id = test_id.replace(".py::", ".").replace("::", ".")
14221-
test_id = test_id.replace("/", ".").replace(" ", "_")
1422214220
elif hasattr(self, "_using_sb_fixture") and self._using_sb_fixture:
1422314221
test_id = sb_config._latest_display_id
14224-
test_id = test_id.replace(".py::", ".").replace("::", ".")
14225-
test_id = test_id.replace("/", ".").replace(" ", "_")
14226-
return test_id
14222+
test_id = test_id.replace(".py::", ".").replace("::", ".")
14223+
test_id = test_id.replace("/", ".").replace(" ", "_")
14224+
# Linux filename length limit for `codecs.open(filename)` = 255
14225+
# 255 - len("latest_logs/") - len("/basic_test_info.txt") = 223
14226+
if len(test_id) <= 223:
14227+
return test_id
14228+
else:
14229+
# 223 - len("__TRUNCATED__") = 210
14230+
# 210 / 2 = 105
14231+
return test_id[:105] + "__TRUNCATED__" + test_id[-105:]
1422714232

1422814233
def __get_test_id_2(self):
1422914234
"""The id for SeleniumBase Dashboard entries."""

0 commit comments

Comments
 (0)