-
Notifications
You must be signed in to change notification settings - Fork 37
Add script for running all tests from inner buildout packages #70
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
base: ea_a499878011598746_separating_awarding
Are you sure you want to change the base?
Add script for running all tests from inner buildout packages #70
Conversation
| import nose | ||
| import argparse | ||
| from pkg_resources import iter_entry_points | ||
| import logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP 8
| import argparse | ||
| from pkg_resources import iter_entry_points | ||
| import logging | ||
|
|
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Якщо більше половини, то ми збільшуємо ? Чому саме так ?
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Все це варто в окрему функцію main закинути
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Навіщо тут exit()?
There was a problem hiding this comment.
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], |
There was a problem hiding this comment.
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
83336c9 to
41de673
Compare
This change is