Skip to content

Commit b693cf6

Browse files
madhanmellanoxMadhan Babu
and
Madhan Babu
authored
Remove SKU create pytest output directory before execution of the script (sonic-net#1226)
Remove SKU create pytest output directory before execution of the script Co-authored-by: Madhan Babu <[email protected]>
1 parent 12e1a0f commit b693cf6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/sku_create_test.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
import sys
21
import os
3-
import pytest
4-
import subprocess
52
import re
3+
import shutil
4+
import subprocess
5+
import sys
6+
7+
import pytest
68

79
test_path = os.path.dirname(os.path.abspath(__file__))
810
modules_path = os.path.dirname(test_path)
911
scripts_path = os.path.join(modules_path, "scripts")
1012
input_path = os.path.join(modules_path, "tests/sku_create_input")
13+
output_dir_path = os.path.join(modules_path, "tests/sku_create_input/Mellanox-SN2700-D48C8_NEW")
1114
sku_def_file = os.path.join(input_path, "Mellanox-SN2700-D48C8.xml")
1215
sku_create_script = os.path.join(scripts_path, "sonic_sku_create.py")
1316
output_file_path = os.path.join(modules_path, "tests/sku_create_input/Mellanox-SN2700-D48C8_NEW/port_config.ini")
@@ -49,6 +52,9 @@ def are_file_contents_same(self,fname1,fname2):
4952
return True
5053

5154
def test_no_param(self):
55+
if (os.path.exists(output_dir_path)):
56+
shutil.rmtree(output_dir_path)
57+
5258
my_command = sku_create_script + " -f " + sku_def_file + " -d " + input_path
5359

5460
#Test case execution without stdout

0 commit comments

Comments
 (0)