Skip to content

Commit

Permalink
test for no matches
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-seaice committed Feb 20, 2025
1 parent 03c2dd9 commit 7964883
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions test/models/test_mom6.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,18 @@ def mom_parameter_doc(request):
model = expt.models[0]

# Create docs
for file in request.param:
filename = os.path.join(model.work_path, file)
make_random_file(filename, 8)
if (request.param != None) :
for file in request.param:
filename = os.path.join(model.work_path, file)
make_random_file(filename, 8)

yield model

# and Tidy up
for file in request.param:
filename = os.path.join(model.work_path, file)
os.remove(filename)
if (request.param != None) :
for file in request.param:
filename = os.path.join(model.work_path, file)
os.remove(filename)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -247,6 +249,24 @@ def test_mom6_not_commit_doc_files(mom_parameter_doc):

assert repo.head.commit == initial_commit, "Payu incorrectly committed MOM_parameter_docs.layout"

@pytest.mark.parametrize(
"mom_parameter_doc",
[None],
indirect=True
)
@pytest.mark.filterwarnings("error")
def test_mom6_not_commit_doc_files(mom_parameter_doc):
# Confirm that mom6_save_doc_files doesn't commits files if runlog is False

#init a git repo
repo = create_new_repo(Path(mom_parameter_doc.control_path))
initial_commit = repo.head.commit

# Function to test
payu.models.mom6.mom6_save_docs_files(mom_parameter_doc)

assert repo.head.commit == initial_commit, "Payu incorrectly committed with no docs to add"


def test_setup():
input_nml = {
Expand Down

0 comments on commit 7964883

Please sign in to comment.