diff options
author | deshevoy <deshevoy@yandex-team.ru> | 2022-02-10 16:46:56 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:56 +0300 |
commit | e988f30484abe5fdeedcc7a5d3c226c01a21800c (patch) | |
tree | 0a217b173aabb57b7e51f8a169989b1a3e0309fe /library/python/pytest/plugins/collection.py | |
parent | 33ee501c05d3f24036ae89766a858930ae66c548 (diff) | |
download | ydb-e988f30484abe5fdeedcc7a5d3c226c01a21800c.tar.gz |
Restoring authorship annotation for <deshevoy@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/python/pytest/plugins/collection.py')
-rw-r--r-- | library/python/pytest/plugins/collection.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/library/python/pytest/plugins/collection.py b/library/python/pytest/plugins/collection.py index e36f47a78f..dad830e473 100644 --- a/library/python/pytest/plugins/collection.py +++ b/library/python/pytest/plugins/collection.py @@ -18,14 +18,14 @@ class LoadedModule(_pytest.python.Module): self.parent = parent self.config = parent.config self.keywords = {} - self.own_markers = [] + self.own_markers = [] self.fspath = py.path.local() @classmethod def from_parent(cls, **kwargs): namespace = kwargs.pop('namespace', True) kwargs.setdefault('fspath', py.path.local()) - + loaded_module = getattr(super(LoadedModule, cls), 'from_parent', cls)(**kwargs) loaded_module.namespace = namespace @@ -44,7 +44,7 @@ class LoadedModule(_pytest.python.Module): def _getobj(self): module_name = self.name[:-len('.py')] - if self.namespace: + if self.namespace: module_name = '__tests__.' + module_name __import__(module_name) return sys.modules[module_name] @@ -54,13 +54,13 @@ class DoctestModule(LoadedModule): def collect(self): import doctest - - module = self._getobj() - # uses internal doctest module parsing mechanism + + module = self._getobj() + # uses internal doctest module parsing mechanism finder = doctest.DocTestFinder() optionflags = _pytest.doctest.get_optionflags(self) runner = doctest.DebugRunner(verbose=0, optionflags=optionflags) - + try: for test in finder.find(module, self.name[:-len('.py')]): if test.examples: # skip empty doctests @@ -94,9 +94,9 @@ def pytest_ignore_collect(module, session, filenames_from_full_filters, accept_f class CollectionPlugin(object): - def __init__(self, test_modules, doctest_modules): + def __init__(self, test_modules, doctest_modules): self._test_modules = test_modules - self._doctest_modules = doctest_modules + self._doctest_modules = doctest_modules def pytest_sessionstart(self, session): @@ -124,5 +124,5 @@ class CollectionPlugin(object): if os.environ.get('YA_PYTEST_DISABLE_DOCTEST', 'no') == 'no': for doctest_module in self._doctest_modules: yield DoctestModule.from_parent(name=doctest_module, parent=session, namespace=False) - + session.collect = collect |