<@ULVA73B9P> I am trying to run pytest tests for m...
# ask-marvin
c
@Marvin I am trying to run pytest tests for my prefect repo, I am getting error "pytest: error: unrecognized arguments: --mypy-only-local-stub". Can you help?
m
The error you're encountering, "pytest: error: unrecognized arguments: --mypy-only-local-stub," suggests that the
pytest
command is being run with an argument it doesn't recognize. This argument seems to be related to
mypy
, a static type checker for Python. Here are a few things you could check: 1. Check pytest command: Ensure that your
pytest
command in your test script or CI/CD pipeline doesn't include
--mypy-only-local-stub
unless you have a plugin or configuration that specifically requires it. 2. Mypy integration: If you're trying to run
mypy
checks alongside your tests, make sure you have the necessary plugins installed. For example,
pytest-mypy
is a plugin that allows integration of
mypy
with
pytest
. 3. Plugin installation: If
--mypy-only-local-stub
is a valid argument for a plugin you intend to use, ensure that the plugin is correctly installed and configured. 4. Check your setup: If you have a
pytest
configuration file (like
pytest.ini
or
conftest.py
), review it for any references to
mypy
arguments that might be incorrectly set. If none of these steps resolve the issue, you might want to check your environment for any custom scripts or configurations that could be introducing this argument. For further assistance, you could also refer to the Prefect GitHub repository to see if there are any related discussions or documentation updates.
c
@Marvin why is command "pytest tests\public\flows" skipping tests in test_flow_timeouts.py file?
m
The issue of pytest skipping tests in the
test_flow_timeouts.py
file could be due to several reasons related to test discovery and configuration. Here are some possibilities: 1. Test Naming Convention: Ensure that the test functions and the file itself are named according to pytest's discovery conventions. Test files should start with
test_
or end with
_test.py
, and test functions should start with
test_
. 2. Markers and Configuration: Check if there are any pytest markers or configurations in your
pytest.ini
or
conftest.py
that might be excluding or skipping certain tests. For example, decorators like
@pytest.mark.skip
or
@pytest.mark.skipif
can cause tests to be skipped. 3. Test Discovery Issues: Verify that the directory structure and the
pytest
command are correctly targeting the directory where
test_flow_timeouts.py
is located. Ensure there are no typos in the path. 4. Pytest Plugins: If you are using pytest plugins, check if any plugin might be affecting the test discovery or execution process. 5. Output and Logs: Run the pytest command with increased verbosity (
pytest -v
) to get more detailed information about which tests are being discovered and executed. If these steps do not resolve the issue, you might want to check the Prefect GitHub repository or the pytest documentation for more insights or similar reported issues.