Skip to content

Commit c61876a

Browse files
committed
Added a test to test the initial_set_up function
1 parent 94a0566 commit c61876a

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

Tests/test_utils.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Addding the python tool
77
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
88

9-
from Easy_versioning.main import initial_setup, final_cleaning, check_default_language, get_versions
9+
from Easy_versioning.main import initial_setup, final_cleaning, check_default_language, get_versions, initial_set_up
1010

1111
# Utils functions
1212
def success(message):
@@ -99,6 +99,30 @@ def test_get_versions():
9999
success("get_versions working as expected")
100100
assert True
101101

102+
def test_initial_set_up():
103+
info("Running initial_set_up test")
104+
105+
# Cleaning the folders
106+
for folder in ["src", "data"]:
107+
if os.path.exists(folder):
108+
shutil.rmtree(folder, onerror=handle_remove_readonly)
109+
110+
# Calling the initial_set_up function
111+
initial_set_up()
112+
113+
# Checking the main folders
114+
assert os.path.exists("src"), "initial_set_up: 'src' not created"
115+
assert os.path.exists("data"), "initial_set_up: 'data' not created"
116+
117+
# Checking the versions
118+
expected_versions = ["V. 1.0", "V. 2.0"]
119+
for version in expected_versions:
120+
version_path = os.path.join("src", version)
121+
assert os.path.exists(version_path), f"initial_set_up: version folder '{version}' not created"
122+
123+
success("initial_set_up working as expected")
124+
125+
102126
# Using the tests function before an official new version of the tool
103127
if __name__ == "__main__":
104128

0 commit comments

Comments
 (0)