diff --git a/airflow_supervisor/tests/config/test_airflow.py b/airflow_supervisor/tests/config/test_airflow.py index c14629b..82c3a26 100644 --- a/airflow_supervisor/tests/config/test_airflow.py +++ b/airflow_supervisor/tests/config/test_airflow.py @@ -1,4 +1,4 @@ -from datetime import UTC, datetime +from getpass import getuser from pathlib import Path from unittest.mock import patch @@ -8,11 +8,9 @@ def test_airflow_inst(): with ( patch("supervisor_pydantic.config.supervisor.gettempdir") as p1, - patch("supervisor_pydantic.config.supervisor.datetime") as p2, ): pth = Path(__file__).resolve().parent.parent.parent.parent / ".pytest_cache" p1.return_value = str(pth) - p2.now.return_value = datetime(2000, 1, 1, 0, 0, 0, 1, tzinfo=UTC) c = SupervisorAirflowConfiguration( airflow=AirflowConfiguration(port="*:9001"), program={ @@ -21,18 +19,16 @@ def test_airflow_inst(): ) }, ) - assert str(c.working_dir) == str(pth / "supervisor-2000-01-01T00-00-00") - assert str(c.config_path) == str(pth / "supervisor-2000-01-01T00-00-00" / "supervisor.cfg") + assert str(c.working_dir) == str(pth / f"supervisor-{getuser()}-test") + assert str(c.config_path) == str(pth / f"supervisor-{getuser()}-test" / "supervisor.cfg") def test_airflow_cfg_roundtrip_json(): with ( patch("supervisor_pydantic.config.supervisor.gettempdir") as p1, - patch("supervisor_pydantic.config.supervisor.datetime") as p2, ): pth = Path(__file__).resolve().parent.parent.parent.parent / ".pytest_cache" p1.return_value = str(pth) - p2.now.return_value = datetime(2000, 1, 1, 0, 0, 0, 1, tzinfo=UTC) c = SupervisorAirflowConfiguration( airflow=AirflowConfiguration(port="*:9001"), program={ diff --git a/airflow_supervisor/tests/hydra/test_hydra.py b/airflow_supervisor/tests/hydra/test_hydra.py index 2a08faf..3ba222c 100644 --- a/airflow_supervisor/tests/hydra/test_hydra.py +++ b/airflow_supervisor/tests/hydra/test_hydra.py @@ -1,4 +1,4 @@ -from datetime import UTC, datetime +from getpass import getuser from pathlib import Path from unittest.mock import patch @@ -8,12 +8,9 @@ def test_hydra_config(): with ( patch("supervisor_pydantic.config.supervisor.gettempdir") as p1, - patch("supervisor_pydantic.config.supervisor.datetime") as p2, ): pth = Path(__file__).resolve().parent.parent.parent.parent / ".pytest_cache" p1.return_value = str(pth) - p2.now.return_value = datetime(2000, 1, 1, 0, 0, 0, 1, tzinfo=UTC) - cfg = load_airflow_config( "config", overrides=["+program=[sleep,echo]", "+rpcinterface=standard", "+inet_http_server=local"] ) @@ -54,6 +51,6 @@ def test_hydra_config(): [rpcinterface:supervisor] supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface""".format( - dir=str(pth / "supervisor-2000-01-01T00-00-00") + dir=str(pth / f"supervisor-{getuser()}-sleep-echo") ) ) diff --git a/pyproject.toml b/pyproject.toml index 6e14afc..4a02efc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,10 +24,10 @@ classifiers = [ ] dependencies = [ - "airflow-ha>=1.2,<1.3", + "airflow-ha>=1.2.2,<1.3", "apache-airflow>=2.8,<3", "airflow-common-operators>=0.2.0,<0.3", - "supervisor-pydantic>=1.1,<1.2", + "supervisor-pydantic>=1.2,<1.3", ] [project.optional-dependencies]