torproject / stem

Python controller library for Tor
https://stem.torproject.org/
GNU Lesser General Public License v3.0
257 stars 75 forks source link

1.8.0: pytest is failing #103

Closed kloczek closed 3 years ago

kloczek commented 3 years ago

Just normal build, install and test cycle used on building package from non-root account:

================================================================================== ERRORS ================================================================================== ____ ERROR collecting docs/_static/example/load_test.py ____ /usr/lib/python3.8/site-packages/_pytest/python.py:578: in _importtestmodule mod = import_path(self.fspath, mode=importmode) /usr/lib/python3.8/site-packages/_pytest/pathlib.py:524: in import_path importlib.import_module(module_name) /usr/lib64/python3.8/importlib/init.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level)

:1014: in _gcd_import ??? :991: in _find_and_load ??? :975: in _find_and_load_unlocked ??? :671: in _load_unlocked ??? /usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:161: in exec_module source_stat, co = _rewrite_test(fn, self.config) /usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:354: in _rewrite_test tree = ast.parse(source, filename=fn_) /usr/lib64/python3.8/ast.py:47: in parse return compile(source, filename, mode, flags, E File "/home/tkloczko/rpmbuild/BUILD/stem-1.8.0/docs/_static/example/load_test.py", line 22 E print '%0.1f%% (%s)' % (sum(samplings) / len(samplings) * 100, stem.util.str_tools.time_label(time.time() - start_time)) E ^ E SyntaxError: invalid syntax ========================================================================= short test summary info ========================================================================== ERROR docs/_static/example/load_test.py !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ============================================================================= 1 error in 0.52s ============================================================================= ```
kloczek commented 3 years ago

OK I see that here is custom testing procedure .. nevertheless I think that it would be good to move to pytest only because pytest has a lot of extensions which allow test and scan code using vast number of pytest extension.

atagar commented 3 years ago

Hi kloczek, please see the following for how to test. I don't plan to move us to pytest.

https://stem.torproject.org/faq.html#how-do-i-run-the-tests

kloczek commented 3 years ago

That is fine however still it would be good fix stem code to allow use pytest because it has many extensions which allows not only test the code over some test units but as well scan and sanitize the code. From that point of view what offers pytest is way beyond what is now implemented in your test suite.

atagar commented 3 years ago

it has many extensions which allows not only test the code over some test units but as well scan and sanitize the code

What specific, concrete benefit does pytest provide that we do not have right now?

kloczek commented 3 years ago

Just look on current list https://docs.pytest.org/en/latest/reference/plugin_list.html Are you sure that all that (or even half) is already supported by what does run_tests.py?

and many, many more ..