Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script for running all tests from inner buildout packages #70

Open
wants to merge 2 commits into
base: ea_a499878011598746_separating_awarding
Choose a base branch
from

Conversation

Scandie
Copy link

@Scandie Scandie commented Feb 21, 2018

This change is Reviewable

run_tests.py Outdated
import nose
import argparse
from pkg_resources import iter_entry_points
import logging

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP 8

run_tests.py Outdated
import argparse
from pkg_resources import iter_entry_points
import logging

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP 8

run_tests.py Outdated
Increase default python recursion depth limit
if tests amount is greater than that value
"""
if (DEFAULT_RECURSION_LIMIT - tests_amount) < DEFAULT_RECURSION_LIMIT / 2:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Якщо більше половини, то ми збільшуємо ? Чому саме так ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Немає фіксованої залежності глибини рекурсії від кількості тестів.
Такий варіант здався оптимальним.

run_tests.py Outdated
sys.setrecursionlimit(tests_amount + DEFAULT_RECURSION_LIMIT)


def get_tests(packages, test_type):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring

run_tests.py Outdated
continue
for entry_point in iter_entry_points(group=group + '.' + test_type):
package_name = group + '.{}'
package_name = package_name.format(entry_point.name)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В одному format буде краще виглядати.

const=True, default=False,
help='List packages that can be tested')
args = parser.parse_args()
unique_packages = set(args.packages)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Все це варто в окрему функцію main закинути

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

І тут викликати.

run_tests.py Outdated
@@ -0,0 +1,92 @@
import sys

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example usage додати сюди і README.

run_tests.py Outdated
tested_packages = list()
all_tests = list()
for pack in packages:
group = pack.split('.')[0] if pack.split('.')[0:1] else None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Якась трохи дивна перевірка. Які значення можуть бути тут pack.split('.')[0:1]?

run_tests.py Outdated
logger.info('PYTESTS:')
for p in pytest_packages:
logger.info("> {}".format(p))
exit()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Навіщо тут exit()?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yarsanich, для того, щоб зупинити виконання скрипта. Опція --list-packages призначена для того, щоб переглянути пакети, які будуть протестовані.

run_tests.py Outdated
NOSE_ENV['NOSE_COVER_PACKAGE'] = cover_packages
unpacked_tests = unpack_suites(nose_tests)
set_recursion_limit(len(unpacked_tests))
sys.exit([suite() for suite in pytests],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generator expression тут не підійде ?

 * Solve maximum recursion depth issue
 * Add instructions to README.md
 * Add example of usage at top of script
@Scandie Scandie force-pushed the a542055734579786_run_tests branch from 83336c9 to 41de673 Compare February 21, 2018 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants