Skip to content

Commit

Permalink
Added Timestamps to not override the folder (#358)
Browse files Browse the repository at this point in the history
Co-authored-by: Valentin Seitz <valentin.seitz@tum.de>
  • Loading branch information
valentin-seitz and Valentin Seitz authored Aug 7, 2023
1 parent b77f0b4 commit 1af7393
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tools/tests/systemtests/Systemtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
from metadata_parser.metdata import Tutorial, Case
from .CmdLineArguments import CmdLineArguments

from datetime import datetime


import unicodedata
import re

Expand Down Expand Up @@ -157,8 +160,9 @@ def __copy_tutorial_into_directory(self, run_directory: Path):
"""
Copies the entire tutorial into a folder to prepare for running.
"""
current_time_string = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
self.run_directory = run_directory
self.tutorial_folder = slugify(f'{self.tutorial.path}_{self.cases}')
self.tutorial_folder = slugify(f'{self.tutorial.path}_{self.cases}_{current_time_string}')
destination = run_directory / self.tutorial_folder
src = Path(__file__).parent.parent.parent.parent / self.tutorial.path
self.system_test_dir = destination
Expand All @@ -170,7 +174,13 @@ def __copy_tools(self, run_directory: Path):
try:
shutil.copytree(src, destination)
except Exception as e:
print(e)
print("tools are already copied: ", e)

def __put_gitignore(self, run_directory: Path):
# Create the .gitignore file with a single asterisk
gitignore_file = run_directory / ".gitignore"
with gitignore_file.open("w") as file:
file.write("*")

def __cleanup(self):
shutil.rmtree(self.run_directory)
Expand Down Expand Up @@ -299,6 +309,7 @@ def run(self, run_directory: Path):
"""
self.__copy_tutorial_into_directory(run_directory)
self.__copy_tools(run_directory)
self.__put_gitignore(run_directory)
std_out: List[str] = []
std_err: List[str] = []
uid, gid = self.__get_uid_gid()
Expand Down

0 comments on commit 1af7393

Please sign in to comment.