We shouild join the efforts and review the providers and attempt to remove db_tests in as many places as possible.
-
Run breeze shell --backend none --skip-db-tests
-
Remove all pytest.mark.db_test by find replace in the provider:
@pytest.mark.db_test -> ''
pytestmark = pytest.mark.db_test -> ''
There are likely also providers with pytestmark = [pytest.mark.db_test,other_marks] or similar
-
In breeze go to the provider cd providers/PROVIDER
-
run pytest tests -> when some tests fail because they "need dn", restore the marks for those tests
-
After all tests succed, run pytest test -n auto -> that should run all the non-db tests with xdist - in parallel, running them with multiple processes - as many processors you have. There are a few tests that are marked as db_tests to be run sequentially for other reasons than DB - running them with xdist should help to see if there are some of them that still need it
-
Add PR with the changes. Our aim is not yet to remove those db calls that hapen currently (yet) - but to see which of the pytest.mark.db_test marks can be removed easily because they were only used by Connections. But it might turn out that some providers will not have any more pytest.mark.db_test - such as airbyte. So if everything is green and provider does not have any more pytest.mark.db_test - please add it to .pre-commit-config.yml (in the same PR).
- id: check-pytest-mark-db-test-in-providers
language: pygrep
name: Check pytest.mark.db_test use in providers
entry: pytest\.mark\.db_test
pass_filenames: true
# Here we should add providers that are already free from the pytest.mark.db_test
# and we want to keep them clean and only use non-db-tests
files: >
(?x)
^providers/airbyte/.*\.py$
Body
After #51930 where @amoghrajesh introduces a way how tests can define connections without DB and follow up in #52017 where I made an attempt to remove some of the
pytest.mark.db_testwe should now remove those marks from providers, where it is easy. Some providers still use DB for other things, but likely there are many providers that only used db to create a Connection and we can turn those tests into non-db tests.We shouild join the efforts and review the providers and attempt to remove db_tests in as many places as possible.
The process of doing it is rather easy:
Run
breeze shell --backend none --skip-db-testsRemove all
pytest.mark.db_testby find replace in the provider:@pytest.mark.db_test-> ''pytestmark = pytest.mark.db_test-> ''There are likely also providers with
pytestmark = [pytest.mark.db_test,other_marks]or similarIn breeze go to the provider
cd providers/PROVIDERrun
pytest tests-> when some tests fail because they "need dn", restore the marks for those testsAfter all tests succed, run
pytest test -n auto-> that should run all the non-db tests with xdist - in parallel, running them with multiple processes - as many processors you have. There are a few tests that are marked asdb_teststo be run sequentially for other reasons than DB - running them with xdist should help to see if there are some of them that still need itAdd PR with the changes. Our aim is not yet to remove those db calls that hapen currently (yet) - but to see which of the
pytest.mark.db_testmarks can be removed easily because they were only used by Connections. But it might turn out that some providers will not have any morepytest.mark.db_test- such as airbyte. So if everything is green and provider does not have any morepytest.mark.db_test- please add it to .pre-commit-config.yml (in the same PR).Add it here adding
|at the end followed by^providers/PROVIDER/.*\.py$Committer