Skip to content

Commit ee7812e

Browse files
committed
Fixing failing tests
1 parent cb0cee3 commit ee7812e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/archetype/archetype.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,16 @@ def create(
7171
self,
7272
projectname: str,
7373
pythonversion: str,
74-
targetfolder: str
74+
targetfolder: str,
75+
templatefolder: str = os.path.join(os.getcwd(), "template")
7576
) -> str:
7677
"""
7778
Creates the project based on the given project name
7879
7980
:param projectname: name of the project
8081
:param pythonversion: Python version used for the generated project
8182
:param targetfolder: Target folder where the generated project should be saved
83+
:param templatefolder: source folder of the project template
8284
:return: returns the path where the project was created
8385
"""
8486
if projectname.isalnum():
@@ -87,7 +89,7 @@ def create(
8789

8890
# create target base folder and move all basic elements like Readme.md
8991
os.makedirs(projectfolder, 0o775)
90-
self.copy_all_files(os.path.join(os.getcwd(), "template"), projectfolder, projectname, pythonversion)
92+
self.copy_all_files(templatefolder, projectfolder, projectname, pythonversion)
9193
return projectfolder
9294

9395
else:

tests/archetype/test_archetype.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def cleanup():
1414
:return:
1515
"""
1616
current_directory = os.getcwd()
17-
test_folder = current_directory + os.path.sep + "test"
17+
test_folder = os.path.join(current_directory, "template")
1818
pycache_folder = current_directory + os.path.sep + "__pycache__"
1919
if os.path.exists(test_folder) and os.path.isdir(test_folder):
2020
shutil.rmtree(test_folder)
@@ -31,13 +31,13 @@ def test_archetype(self):
3131
# given
3232
self.cleanup()
3333
archetype = Archetype()
34-
path = os.path.join(os.getcwd().replace("tests", "src"), "template")
34+
path = os.path.join(os.getcwd().replace("tests", "src"), os.getcwd(), "template")
3535

3636
# when
37-
result = archetype.create("test", path)
37+
result = archetype.create("test", "3.7", path, os.path.join(os.getcwd().replace("tests", "src"), "template"))
3838

3939
# then
40-
self.assertEqual(result, os.path.join(os.getcwd(), "test"))
40+
self.assertEqual(result, os.path.join(path, "test"))
4141

4242
if os.path.exists(result) and os.path.isdir(result):
4343
shutil.rmtree(result)

0 commit comments

Comments
 (0)