Skip to content

Commit

Permalink
#221 Clean files if created so next test tests for file creations (d…
Browse files Browse the repository at this point in the history
…iff. case)
  • Loading branch information
Dana Singh authored and Dana Singh committed Feb 3, 2025
1 parent 0e94dea commit 39b21b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 3 additions & 4 deletions fre/make/tests/test_create_dockerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
# container root (as set in platform yaml)
MODEL_ROOT = "/apps"

#def dockerfile_create(yamlfile,platform,target,execute):

# yaml file checks
def test_modelyaml_exists():
assert Path(f"{YAMLDIR}/{YAMLFILE}").exists()
Expand All @@ -54,7 +52,6 @@ def test_bad_yamlpath_option():
''' test create-dockerfile with a invalid yaml option'''
create_docker_script.dockerfile_create(BADOPT[0], PLATFORM, TARGET, False, False)


def test_no_op_platform():
'''test create-dockerfile will do nothing if non-container platform is given'''
if Path(os.getcwd()+"/tmp").exists():
Expand All @@ -65,6 +62,9 @@ def test_no_op_platform():
# tests container build script/makefile/dockerfile creation
def test_create_dockerfile():
'''run create-dockerfile with options for containerized build'''
if Path(f"{os.getcwd()}/Dockerfile").exists():
Path(f"{os.getcwd()}/Dockerfile").unlink()
Path(f"{os.getcwd()}/createContainer.sh").unlink()
create_docker_script.dockerfile_create(YAMLPATH, PLATFORM, TARGET, False, False)

def test_container_dir_creation():
Expand Down Expand Up @@ -100,4 +100,3 @@ def test_dockerfile_contents():

line = copy_lines[2].strip().split()
assert line == ["COPY", f"tmp/{PLATFORM[0]}/execrunscript.sh", f"{MODEL_ROOT}/{EXPERIMENT}/exec/execrunscript.sh"]

8 changes: 6 additions & 2 deletions fre/make/tests/test_run_fremake.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ def test_run_fremake_makefile_creation_multijob():
# tests container build script/makefile/dockerfile creation
def test_run_fremake_container():
'''run run-fremake with options for containerized build'''
if Path("Dockerfile").exists() or Path("createContainer.sh").exists():
Path(f"{os.getcwd()}/Dockerfile").unlink()
Path(f"{os.getcwd()}/createContainer.sh").unlink()

run_fremake_script.fremake_run(YAMLPATH, CONTAINER_PLATFORM, TARGET, False, 1, True, False, VERBOSE, False, False, False)

def test_run_fremake_build_script_creation_container():
Expand Down Expand Up @@ -153,8 +157,8 @@ def test_run_fremake_2stage_container():
# Without force-dockerfile or force-checkout option, clean files first
# or else it'll read that they exist already and not make the execrunscript.sh
if Path("Dockerfile").exists() or Path("createContainer.sh").exists():
os.remove(Path("Dockerfile"))
os.remove(Path("createContainer.sh"))
Path("Dockerfile").unlink()
Path("createContainer.sh").unlink()

run_fremake_script.fremake_run(YAMLPATH, CONTAINER_PLAT2, TARGET, False, 1, True, False, VERBOSE, False, False, False)

Expand Down

0 comments on commit 39b21b9

Please sign in to comment.