import operator
import os
from typing import Callable
+import argparse
from dateutil.tz import (
tzlocal,
action="store_true",
help="Fail if a test is skipped for missing data file.",
)
+ parser.addoption("--deb-data-root-dir",action="store",help=argparse.SUPPRESS)#for internal use of the Debian CI infrastructure, may change without warning. Security note: test_pickle can run arbitrary code from this directory
def ignore_doctest_warning(item: pytest.Item, path: str, message: str) -> None:
@pytest.fixture
-def datapath(strict_data_files: str) -> Callable[..., str]:
+def datapath(strict_data_files: str,pytestconfig) -> Callable[..., str]:
"""
Get the path to a data file.
ValueError
If the path doesn't exist and the --strict-data-files option is set.
"""
- BASE_PATH = os.path.join(os.path.dirname(__file__), "tests")
+ BASE_PATH = pytestconfig.getoption("--deb-data-root-dir",default=None)
+ if BASE_PATH is None:
+ BASE_PATH = os.path.join(os.path.dirname(__file__), "tests")
def deco(*args):
path = os.path.join(BASE_PATH, *args)
return env.get_template("html_table.tpl")
+@pytest.mark.xfail(reason="--deb-data-root-dir is expected to break this",strict=False)
def test_html_template_extends_options():
# make sure if templates are edited tests are updated as are setup fixtures
# to understand the dependency
datapath("not_a_file")
+@pytest.mark.xfail(reason="--deb-data-root-dir intentionally breaks this",strict=False)
def test_datapath(datapath):
args = ("io", "data", "csv", "iris.csv")