fix condition in run_unit_tests.sh + fix indent + remove duplicated loaded config
This commit is contained in:
Родитель
4563df404c
Коммит
732297b7f5
|
@ -116,13 +116,13 @@ Once your unit test environment is setup, you should be able to simply run
|
|||
For example, in order to just execute the "core" unit tests, run the following:
|
||||
|
||||
```
|
||||
./run_unit_tests.sh tests.core:CoreTest
|
||||
./run_unit_tests.sh tests.core:CoreTest -s
|
||||
```
|
||||
|
||||
or a single test method:
|
||||
|
||||
```
|
||||
./run_unit_tests.sh tests.core:CoreTest.test_check_operators
|
||||
./run_unit_tests.sh tests.core:CoreTest.test_check_operators -s
|
||||
```
|
||||
|
||||
For more information on how to run a subset of the tests, take a look at the nosetests docs.
|
||||
|
|
|
@ -138,7 +138,7 @@ def run(args):
|
|||
if not args.pickle:
|
||||
dagbag = DagBag(subdir)
|
||||
if args.dag_id not in dagbag.dags:
|
||||
msg = 'DAG [{0}] could not be found'.format(args.dag_id)
|
||||
msg = 'DAG [{0}] could not be found in {1}'.format(args.dag_id, subdir)
|
||||
logging.error(msg)
|
||||
raise AirflowException(msg)
|
||||
dag = dagbag.dags[args.dag_id]
|
||||
|
|
|
@ -402,7 +402,6 @@ def parameterized_config(template):
|
|||
current scope
|
||||
:param template: a config content templated with {{variables}}
|
||||
"""
|
||||
|
||||
FERNET_KEY = generate_fernet_key()
|
||||
all_vars = {k: v for d in [globals(), locals()] for k, v in d.items()}
|
||||
return template.format(**all_vars)
|
||||
|
@ -424,12 +423,6 @@ if not os.path.isfile(AIRFLOW_CONFIG):
|
|||
with open(AIRFLOW_CONFIG, 'w') as f:
|
||||
f.write(parameterized_config(DEFAULT_CONFIG))
|
||||
|
||||
TEST_CONFIG_FILE = AIRFLOW_HOME + '/unittests.cfg'
|
||||
if not os.path.isfile(TEST_CONFIG_FILE):
|
||||
logging.info("Creating new config file in: " + TEST_CONFIG_FILE)
|
||||
with open(TEST_CONFIG_FILE, 'w') as f:
|
||||
f.write(TEST_CONFIG.format(**locals()))
|
||||
|
||||
logging.info("Reading the config from " + AIRFLOW_CONFIG)
|
||||
|
||||
|
||||
|
|
|
@ -6,12 +6,13 @@ export AIRFLOW_CONFIG=$AIRFLOW_HOME/unittests.cfg
|
|||
# any argument received is overriding the default nose execution arguments:
|
||||
|
||||
nose_args=$@
|
||||
if [ -a $nose_args ]; then
|
||||
if [ -z "$nose_args" ]; then
|
||||
nose_args="--with-coverage \
|
||||
--cover-erase \
|
||||
--cover-html \
|
||||
--cover-package=airflow \
|
||||
--cover-html-dir=airflow/www/static/coverage \
|
||||
-s \
|
||||
-v \
|
||||
--logging-level=DEBUG "
|
||||
fi
|
||||
|
|
Загрузка…
Ссылка в новой задаче