-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Scripts to execute copying task
- Loading branch information
Showing
3 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
supporting_scripts/course-scripts/quick-course-setup/randomize_results_after.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
import shutil | ||
from logging_config import logging | ||
|
||
test_files_folder = "../../../src/main/resources/templates/java/test/testFiles" | ||
default_folder = "./testFiles-template/default" | ||
random_test_case_dest = os.path.join(test_files_folder, "RandomizedTestCases.java") | ||
|
||
def delete_random_test_case(): | ||
if os.path.exists(random_test_case_dest): | ||
os.remove(random_test_case_dest) | ||
logging.info(f"Deleted file: {random_test_case_dest}") | ||
else: | ||
logging.info(f"RandomizedTestCases.java file not found at {random_test_case_dest}") | ||
|
||
def copy_default_folders(): | ||
for folder_name in os.listdir(default_folder): | ||
src_folder_path = os.path.join(default_folder, folder_name) | ||
dest_folder_path = os.path.join(test_files_folder, folder_name) | ||
if os.path.isdir(src_folder_path): | ||
shutil.copytree(src_folder_path, dest_folder_path) | ||
logging.info(f"Copied folder {src_folder_path} to {dest_folder_path}") | ||
|
||
if __name__ == "__main__": | ||
# Run this after running the script | ||
delete_random_test_case() | ||
copy_default_folders() |
29 changes: 29 additions & 0 deletions
29
supporting_scripts/course-scripts/quick-course-setup/randomize_results_before.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
import shutil | ||
from logging_config import logging | ||
|
||
test_files_folder = "../../../src/main/resources/templates/java/test/testFiles" | ||
random_test_case_file = "./testFiles-template/randomized/RandomizedTestCases.java" | ||
random_test_case_dest = os.path.join(test_files_folder, "RandomizedTestCases.java") | ||
|
||
def delete_existing_folders(): | ||
folders_to_delete = ["behavior", "structural"] | ||
for folder in folders_to_delete: | ||
folder_path = os.path.join(test_files_folder, folder) | ||
if os.path.exists(folder_path) and os.path.isdir(folder_path): | ||
shutil.rmtree(folder_path) | ||
logging.info(f"Deleted folder: {folder_path}") | ||
else: | ||
logging.info(f"Folder not found: {folder_path}") | ||
|
||
def copy_random_test_case(): | ||
if os.path.exists(random_test_case_file): | ||
shutil.copy(random_test_case_file, random_test_case_dest) | ||
logging.info(f"Copied {random_test_case_file} to {random_test_case_dest}") | ||
else: | ||
logging.info(f"RandomizedTestCases.java file not found at {random_test_case_file}") | ||
|
||
if __name__ == "__main__": | ||
# Run this before running the script | ||
delete_existing_folders() | ||
copy_random_test_case() |