diff options
author | thegeorg <thegeorg@yandex-team.com> | 2023-08-24 13:46:13 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2023-08-24 14:01:39 +0300 |
commit | a0e8ac430192b8b6acda11beccd9abe68ccd5fba (patch) | |
tree | a96631f8d231132eee007d075128b07fa43b9fb5 /library/python/pytest/main.py | |
parent | b3702478a961fe7ab5fc435582ff9fe75b8a0460 (diff) | |
download | ydb-a0e8ac430192b8b6acda11beccd9abe68ccd5fba.tar.gz |
Fix some style issues in library/python/pytest
Two issues remain unfixed:
```
[fail] library/python/pytest/rewrite.py:96: [PLW0122] Use of exec (exec-used)
[fail] library/python/pytest/yatest_tools.py:49: [F821] undefined name 'unicode'
```
Diffstat (limited to 'library/python/pytest/main.py')
-rw-r--r-- | library/python/pytest/main.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/library/python/pytest/main.py b/library/python/pytest/main.py index 44046683eb..6059ff45a3 100644 --- a/library/python/pytest/main.py +++ b/library/python/pytest/main.py @@ -9,6 +9,7 @@ FORCE_EXIT_TESTSFAILED_ENV = 'FORCE_EXIT_TESTSFAILED' def main(): import library.python.pytest.context as context + context.Ctx["YA_PYTEST_START_TIMESTAMP"] = time.time() profile = None @@ -17,6 +18,7 @@ def main(): import pstats import cProfile + profile = cProfile.Profile() profile.enable() @@ -42,14 +44,18 @@ def main(): import _pytest.assertion from _pytest.monkeypatch import MonkeyPatch from . import rewrite + m = MonkeyPatch() m.setattr(_pytest.assertion.rewrite, "AssertionRewritingHook", rewrite.AssertionRewritingHook) prefix = '__tests__.' test_modules = [ - name[len(prefix):] for name in sys.extra_modules + # fmt: off + name[len(prefix) :] + for name in sys.extra_modules if name.startswith(prefix) and not name.endswith('.conftest') + # fmt: on ] doctest_packages = __res.find("PY_DOCTEST_PACKAGES") or "" @@ -64,8 +70,11 @@ def main(): return False doctest_modules = [ - name for name in sys.extra_modules + # fmt: off + name + for name in sys.extra_modules if is_doctest_module(name) + # fmt: on ] def remove_user_site(paths): @@ -85,11 +94,13 @@ def main(): return new_paths sys.path = remove_user_site(sys.path) - rc = pytest.main(plugins=[ - collection.CollectionPlugin(test_modules, doctest_modules), - ya, - conftests, - ]) + rc = pytest.main( + plugins=[ + collection.CollectionPlugin(test_modules, doctest_modules), + ya, + conftests, + ] + ) if rc == 5: # don't care about EXIT_NOTESTSCOLLECTED |