Skip to content

Commit

Permalink
Add a simple test for the new script. Currently only checking that it…
Browse files Browse the repository at this point in the history
… runs.
  • Loading branch information
micaeljtoliveira committed Jun 30, 2022
1 parent e742902 commit 5bd09f6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cosima_cookbook/database_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import cosima_cookbook as cc


def main():
def main(argv=None):
parser = argparse.ArgumentParser(description="Update COSIMA cookbook database.")
parser.add_argument(
"dirs", type=pathlib.Path, nargs="+", help="Directories to index."
Expand All @@ -17,7 +17,7 @@ def main():
default="cosima_master.db",
help="Database to update.",
)
args = parser.parse_args()
args = parser.parse_args(argv)

print(cc)

Expand Down
Binary file added test/data/update/experiment_a/test1.nc
Binary file not shown.
Binary file added test/data/update/experiment_b/test2.nc
Binary file not shown.
13 changes: 13 additions & 0 deletions test/test_update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import shlex
from cosima_cookbook import database_update


def test_database_update(tmpdir):

args = shlex.split(
"-db {db} test/data/update/experiment_a test/data/update/experiment_b".format(
db=tmpdir.join("test.db")
)
)

database_update.main(args)

0 comments on commit 5bd09f6

Please sign in to comment.