Skip to content

Commit fd4bef3

Browse files
committed
"os.path.join()" should be used for joining a path with a file
1 parent 71db9cd commit fd4bef3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3286,7 +3286,7 @@ def save_cookies(self, name="cookies.txt"):
32863286
file_path = abs_path + "/%s" % folder
32873287
if not os.path.exists(file_path):
32883288
os.makedirs(file_path)
3289-
cookies_file_path = "%s/%s" % (file_path, name)
3289+
cookies_file_path = os.path.join(file_path, name)
32903290
cookies_file = codecs.open(cookies_file_path, "w+", encoding="utf-8")
32913291
cookies_file.writelines(json_cookies)
32923292
cookies_file.close()
@@ -3305,7 +3305,7 @@ def load_cookies(self, name="cookies.txt"):
33053305
folder = constants.SavedCookies.STORAGE_FOLDER
33063306
abs_path = os.path.abspath(".")
33073307
file_path = abs_path + "/%s" % folder
3308-
cookies_file_path = "%s/%s" % (file_path, name)
3308+
cookies_file_path = os.path.join(file_path, name)
33093309
json_cookies = None
33103310
with open(cookies_file_path, "r") as f:
33113311
json_cookies = f.read().strip()
@@ -3341,7 +3341,7 @@ def delete_saved_cookies(self, name="cookies.txt"):
33413341
folder = constants.SavedCookies.STORAGE_FOLDER
33423342
abs_path = os.path.abspath(".")
33433343
file_path = abs_path + "/%s" % folder
3344-
cookies_file_path = "%s/%s" % (file_path, name)
3344+
cookies_file_path = os.path.join(file_path, name)
33453345
if os.path.exists(cookies_file_path):
33463346
if cookies_file_path.endswith(".txt"):
33473347
os.remove(cookies_file_path)
@@ -4213,7 +4213,7 @@ def __process_recorded_actions(self):
42134213
file_name = sb_config.behave_scenario.filename.replace(".", "_")
42144214
file_name = file_name.split("/")[-1].split("\\")[-1]
42154215
file_name = file_name + "_rec.py"
4216-
file_path = "%s/%s" % (recordings_folder, file_name)
4216+
file_path = os.path.join(recordings_folder, file_name)
42174217
out_file = codecs.open(file_path, "w+", "utf-8")
42184218
out_file.writelines("\r\n".join(data))
42194219
out_file.close()
@@ -5417,7 +5417,7 @@ def save_element_as_image_file(
54175417
folder = folder[:-1]
54185418
if len(folder) > 0:
54195419
self.create_folder(folder)
5420-
image_file_path = "%s/%s" % (folder, file_name)
5420+
image_file_path = os.path.join(folder, file_name)
54215421
if not image_file_path:
54225422
image_file_path = file_name
54235423
with open(image_file_path, "wb") as file:
@@ -12927,7 +12927,7 @@ def tearDown(self):
1292712927

1292812928
s3_bucket = S3LoggingBucket()
1292912929
guid = str(uuid.uuid4().hex)
12930-
path = "%s/%s" % (self.log_path, test_id)
12930+
path = os.path.join(self.log_path, test_id)
1293112931
uploaded_files = []
1293212932
for logfile in os.listdir(path):
1293312933
logfile_name = "%s/%s/%s" % (
@@ -12936,7 +12936,7 @@ def tearDown(self):
1293612936
logfile.split(path)[-1],
1293712937
)
1293812938
s3_bucket.upload_file(
12939-
logfile_name, "%s/%s" % (path, logfile)
12939+
logfile_name, "%s" % os.path.join(path, logfile)
1294012940
)
1294112941
uploaded_files.append(logfile_name)
1294212942
s3_bucket.save_uploaded_file_names(uploaded_files)

0 commit comments

Comments
 (0)