Skip to content

Commit

Permalink
correcting bug in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Arbel committed Feb 28, 2024
1 parent a3fd495 commit 369d35b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 34 deletions.
2 changes: 1 addition & 1 deletion run_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ fi
version="3.9"
cd docs
pip install sphinx furo autodocsumm sphinx_multiversion
sphinx_multiversion html . _build/html
sphinx-multiversion html . _build/html


8 changes: 6 additions & 2 deletions tests/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ def _delete_directory(log_dir):
import shutil
import os
if os.path.exists(log_dir):
shutil.rmtree(log_dir)

try:
shutil.rmtree(log_dir)
except:
pass

@pytest.fixture
def logger():
Expand All @@ -25,6 +27,8 @@ def logger():
logger = Logger(log_dir)
yield logger

_delete_directory(log_dir)

def test_Logger(logger):
# Create a logger object to log the results of the experiment
assert logger.log_id == 1
Expand Down
23 changes: 0 additions & 23 deletions tests/test_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,3 @@ def test_mlxpsub_launching(script):
ignore = "Use of uninitialized value" in error or "mlxp.errors.JobSubmissionError" in error
if not ignore:
assert not error




scripts = pathlib.Path(tutorial_path).resolve().glob('read_script.sh')

@pytest.mark.parametrize('script', scripts)
def test_reading(script):

parent_path = str(script.parent)
sys.path.insert(0,parent_path)

with open(script, 'r') as file:
script_code = file.read()
rc = subprocess.call([f"cd {tutorial_path}\n"+script_code] , shell=True)

try:
shutil.rmtree(os.path.join(tutorial_path,'logs'))
except:
pass

assert rc==0

7 changes: 6 additions & 1 deletion tutorial/launch_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@


python main.py model.num_units=2,3,4 optimizer.lr=10.,1. seed=1,2,3\
+mlxp.use_version_manager=False +mlxp.interactive_mode=False
+mlxp.use_version_manager=False +mlxp.interactive_mode=False

sleep 10


python read.py
3 changes: 0 additions & 3 deletions tutorial/mlxpsub_launch_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@
chmod u+x launch_script.sh
mlxpsub launch_script.sh



sleep 10
4 changes: 0 additions & 4 deletions tutorial/read_script.sh

This file was deleted.

0 comments on commit 369d35b

Please sign in to comment.