Skip to content

Commit

Permalink
fix(tests): use firestore bemulator for run cli tets
Browse files Browse the repository at this point in the history
  • Loading branch information
akhileshh committed Jun 10, 2024
1 parent 0f325d5 commit 3599550
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import pytest

import docker
from zetta_utils import constants

constants.RUN_DATABASE = None


def pytest_addoption(parser):
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def register_dummy():
{"@type": "dummy", "i": {"a": "b"}},
],
)
def test_zetta_run(spec, register_dummy, mocker, datastore_emulator):
def test_zetta_run(spec, register_dummy, mocker, firestore_emulator):
mocker.patch("zetta_utils.parsing.cue.load", return_value=spec)
runner = CliRunner()

Expand All @@ -50,7 +50,7 @@ def test_show_registry(register_dummy):
{"@type": "dummy", "i": {"a": "b"}},
],
)
def test_zetta_run_str(spec, register_dummy, mocker, datastore_emulator):
def test_zetta_run_str(spec, register_dummy, mocker, firestore_emulator):
mocker.patch(
"fsspec.open",
side_effect=[tempfile.TemporaryFile(mode="w"), tempfile.TemporaryFile(mode="w")],
Expand All @@ -67,14 +67,14 @@ def test_zetta_run_str(spec, register_dummy, mocker, datastore_emulator):
SPEC_WITH_CUSTOM_IMPORT = {"@type": "registered_in_file"}


def test_zetta_run_extra_import_fail(tmp_path, datastore_emulator):
def test_zetta_run_extra_import_fail(tmp_path, firestore_emulator):
runner = CliRunner()
# make sure that it doesn't run without a file import
should_fail = runner.invoke(cli.run, ["-s", json.dumps(SPEC_WITH_CUSTOM_IMPORT)])
assert should_fail.exit_code != 0


def test_zetta_run_extra_import_success(tmp_path, mocker, datastore_emulator):
def test_zetta_run_extra_import_success(tmp_path, mocker, firestore_emulator):
mocker.patch(
"fsspec.open",
side_effect=[tempfile.TemporaryFile(mode="w"), tempfile.TemporaryFile(mode="w")],
Expand All @@ -88,7 +88,7 @@ def test_zetta_run_extra_import_success(tmp_path, mocker, datastore_emulator):
assert should_succeed.exit_code == 0


def test_zetta_run_extra_import_py_check_fail(tmp_path, datastore_emulator):
def test_zetta_run_extra_import_py_check_fail(tmp_path, firestore_emulator):
runner = CliRunner()
my_file = tmp_path / "custom_import"
my_file.write_text(CUSTOM_IMPORT_CONTENT)
Expand Down
2 changes: 1 addition & 1 deletion zetta_utils/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Common project-wide constants."""

DEFAULT_PROJECT = "zetta-research"
RUN_DATABASE = "run-db"
RUN_DATABASE: str | None = "run-db"

0 comments on commit 3599550

Please sign in to comment.