[AIRFLOW-6216] Allow pytests to be run without "tests" (#6770)
With this change you should be able to simply run `pytest` to run all the tests in the main airflow directory. This consist of two changes: * moving pytest.ini to the main airflow directory * skipping collecting kubernetes tests when ENV != kubernetes
This commit is contained in:
Родитель
da7a353e17
Коммит
239d51ed31
|
@ -40,6 +40,7 @@
|
|||
!.rat-excludes
|
||||
!.flake8
|
||||
!pylintrc
|
||||
!pytest.ini
|
||||
!LICENSE
|
||||
!MANIFEST.in
|
||||
!NOTICE
|
||||
|
|
|
@ -340,7 +340,7 @@ COPY docs/ ${AIRFLOW_SOURCES}/docs/
|
|||
COPY tests/ ${AIRFLOW_SOURCES}/tests/
|
||||
COPY airflow/ ${AIRFLOW_SOURCES}/airflow/
|
||||
COPY .coveragerc .rat-excludes .flake8 pylintrc LICENSE MANIFEST.in NOTICE CHANGELOG.txt \
|
||||
.github \
|
||||
.github pytest.ini \
|
||||
setup.cfg setup.py \
|
||||
${AIRFLOW_SOURCES}/
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ addopts =
|
|||
--ignore=tests/dags/test_impersonation_subdag.py
|
||||
--ignore=tests/dags/test_subdag.py
|
||||
norecursedirs =
|
||||
.eggs
|
||||
airflow
|
||||
tests/dags_with_system_exit
|
||||
tests/test_utils
|
||||
tests/dags_corrupted
|
|
@ -105,6 +105,7 @@ elif [[ ${AIRFLOW_MOUNT_HOST_VOLUMES_FOR_STATIC_CHECKS} == "true" ]]; then
|
|||
"-v" "${AIRFLOW_SOURCES}/tests:/opt/airflow/tests:cached" \
|
||||
"-v" "${AIRFLOW_SOURCES}/.flake8:/opt/airflow/.flake8:cached" \
|
||||
"-v" "${AIRFLOW_SOURCES}/pylintrc:/opt/airflow/pylintrc:cached" \
|
||||
"-v" "${AIRFLOW_SOURCES}/pytest.ini:/opt/airflow/pytest.ini:cached" \
|
||||
"-v" "${AIRFLOW_SOURCES}/setup.cfg:/opt/airflow/setup.cfg:cached" \
|
||||
"-v" "${AIRFLOW_SOURCES}/setup.py:/opt/airflow/setup.py:cached" \
|
||||
"-v" "${AIRFLOW_SOURCES}/.rat-excludes:/opt/airflow/.rat-excludes:cached" \
|
||||
|
|
|
@ -50,6 +50,7 @@ services:
|
|||
- ../../.inputrc:/root/.inputrc:cached
|
||||
- ../../.flake8:/opt/airflow/.flake8:cached
|
||||
- ../../pylintrc:/opt/airflow/pylintrc:cached
|
||||
- ../../pytest.ini:/opt/airflow/pytest.ini:cached
|
||||
- ../../.rat-excludes:/opt/airflow/.rat-excludes:cached
|
||||
- ../../logs:/root/airflow/logs:cached
|
||||
- ../../tmp:/opt/airflow/tmp:cached
|
||||
|
|
|
@ -30,7 +30,7 @@ from urllib3.util.retry import Retry
|
|||
try:
|
||||
check_call(["/usr/local/bin/kubectl", "get", "pods"])
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
if os.environ.get('KUBERNETES_VERSION'):
|
||||
if os.environ.get('KUBERNETES_VERSION') and os.environ.get('ENV', 'kubernetes') == 'kubernetes':
|
||||
raise e
|
||||
else:
|
||||
raise unittest.SkipTest(
|
||||
|
|
|
@ -40,7 +40,7 @@ from airflow.version import version as airflow_version
|
|||
try:
|
||||
check_call(["/usr/local/bin/kubectl", "get", "pods"])
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
if os.environ.get('KUBERNETES_VERSION'):
|
||||
if os.environ.get('KUBERNETES_VERSION') and os.environ.get('ENV', 'kubernetes') == 'kubernetes':
|
||||
raise e
|
||||
else:
|
||||
raise unittest.SkipTest(
|
||||
|
|
Загрузка…
Ссылка в новой задаче