2021-03-18 02:05:05 -04:00
|
|
|
import logging
|
2021-02-11 12:53:44 -08:00
|
|
|
import os
|
2021-03-11 02:29:24 -05:00
|
|
|
import time
|
|
|
|
|
|
|
|
import pytest
|
2021-02-11 12:53:44 -08:00
|
|
|
|
2022-07-29 09:41:31 +00:00
|
|
|
# Enable debug logging.
|
|
|
|
logging.getLogger().setLevel(logging.DEBUG)
|
|
|
|
os.environ["DATAHUB_DEBUG"] = "1"
|
|
|
|
|
|
|
|
# Disable telemetry
|
|
|
|
os.environ["DATAHUB_TELEMETRY_ENABLED"] = "false"
|
|
|
|
|
|
|
|
# Reduce retries on GMS, because this causes tests to hang while sleeping
|
|
|
|
# between retries.
|
|
|
|
os.environ["DATAHUB_REST_EMITTER_DEFAULT_RETRY_MAX_TIMES"] = "1"
|
|
|
|
|
|
|
|
# We need our imports to go below the os.environ updates, since mere act
|
|
|
|
# of importing some datahub modules will load env variables.
|
|
|
|
from tests.test_helpers.docker_helpers import docker_compose_runner # noqa: F401,E402
|
|
|
|
from tests.test_helpers.state_helpers import mock_datahub_graph # noqa: F401,E402
|
2021-03-11 02:29:24 -05:00
|
|
|
|
2021-11-07 18:53:53 -08:00
|
|
|
try:
|
|
|
|
# See https://github.com/spulec/freezegun/issues/98#issuecomment-590553475.
|
|
|
|
import pandas # noqa: F401
|
|
|
|
except ImportError:
|
|
|
|
pass
|
|
|
|
|
2021-03-11 02:29:24 -05:00
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def mock_time(monkeypatch):
|
|
|
|
def fake_time():
|
|
|
|
return 1615443388.0975091
|
|
|
|
|
|
|
|
monkeypatch.setattr(time, "time", fake_time)
|
2021-06-30 16:53:20 -07:00
|
|
|
|
2021-03-11 02:29:24 -05:00
|
|
|
yield
|
2021-06-30 16:53:20 -07:00
|
|
|
|
|
|
|
|
|
|
|
def pytest_addoption(parser):
|
|
|
|
parser.addoption(
|
|
|
|
"--update-golden-files",
|
|
|
|
action="store_true",
|
|
|
|
default=False,
|
|
|
|
)
|
2022-10-23 23:31:48 -07:00
|
|
|
parser.addoption("--copy-output-files", action="store_true", default=False)
|