rhythmic-battery-45198
07/05/2022, 7:41 PMpython_test targets which I would like to run with additional pytest arguments. python_test target does not have any fields for pytest arguments, and I think that makes sense to me. I can add pytest arguments via cli args or pants.toml. I would like to codify the mapping between python_test targets and pytest arguments. I can create a pants.jupyter_tests.toml and override both tag and pytest.args. This works but might lead to a proliferation of .toml files if we have lots of different sets of tests which require specific arguments. Am I missing another better way to configure my project?rhythmic-battery-45198
07/05/2022, 7:43 PM--nbmake pytest argument.bitter-ability-32190
07/05/2022, 8:07 PMconftest.py that mucks with pytest/that pluginhundreds-father-404
07/05/2022, 8:08 PMrhythmic-battery-45198
07/05/2022, 8:08 PMhundreds-father-404
07/05/2022, 8:08 PMenough-analyst-54434
07/05/2022, 8:10 PMenough-analyst-54434
07/05/2022, 9:17 PMrhythmic-battery-45198
07/05/2022, 9:31 PMPYTEST_ADDOPTS environment variable for including extra cli options.  https://docs.pytest.org/en/7.1.x/example/simple.html . I'll probably create something like a nb_test macro and set PYTEST_ADDOPTS=--nbmake for my specific use case. That should be functionally equivalent to an args field in the pytest target.happy-kitchen-89482
07/05/2022, 9:38 PMhappy-kitchen-89482
07/05/2022, 9:39 PMrhythmic-battery-45198
07/05/2022, 9:39 PMpython_test.extra_env_vars https://www.pantsbuild.org/docs/reference-python_test#codeextra_env_varscodehappy-kitchen-89482
07/05/2022, 9:40 PMhappy-kitchen-89482
07/05/2022, 9:40 PMhappy-kitchen-89482
07/05/2022, 9:40 PMrhythmic-battery-45198
07/05/2022, 9:41 PMrhythmic-battery-45198
07/05/2022, 11:01 PMPYTEST_ADDOPTS_VAR = "PYTEST_ADDOPTS"
def nbmake_test(**kwargs):
    extra_env_vars = kwargs.pop("extra_env_vars", {})
    pytest_addopts = extra_env_vars.pop(PYTEST_ADDOPTS_VAR, "")
    pytest_addopts += " --nbmake"
    extra_env_vars[PYTEST_ADDOPTS_VAR] = pytest_addopts
    python_test(**kwargs)rhythmic-battery-45198
07/05/2022, 11:03 PMpytest against files without`.py` extension.
InvalidFieldException: The 'source' field in target src/python/<>:<>_nb_test can only contain files that end in one of ['', '.py'], but it had these files: ['src/python/<>/<>.ipynb'].hundreds-father-404
07/05/2022, 11:06 PMnotebook_test, where all the fields are the same as python_test except for subclassing PythonSourceField and setting expected_file_extensions = (".ipynb",)
https://www.pantsbuild.org/docs/target-api-concepts and the 2 pages after itrhythmic-battery-45198
07/05/2022, 11:06 PMhundreds-father-404
07/05/2022, 11:07 PM.ipynb to work with python_source and python_test? That has many implications like that MyPy will run on those notebooks. Given that notebooks tend to be experimental, we figured in the past they are best handled via dedicated targetsrhythmic-battery-45198
07/05/2022, 11:15 PM.ipynb as python source internally. We don't have .ipynb unit tests with assertions or include them in linting. Trying to put some sanity checks around keeping the notebooks maintained but not sure how deep of a rabbit-hole we want to go down treating it as first class source code.hundreds-father-404
07/05/2022, 11:16 PMskip_tests field defaults to False. You can subclass it and have it default to True