Test failure AutoImportTest.test_search_submodule: AssertionError: ('from build import env', 'env') not found in []
Hi, does anyone know why this test might be failing?
======================================================================
FAIL: test_search_submodule (ropetest.contrib.autoimporttest.AutoImportTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/guix-build-python-rope-1.1.1.drv-0/rope-1.1.1/ropetest/contrib/autoimporttest.py", line 121, in test_search_submodule
self.assertIn(import_statement, self.importer.search("env", exact_match=True))
AssertionError: ('from build import env', 'env') not found in []
----------------------------------------------------------------------
Ran 1892 tests in 14.880s
FAILED (failures=1, skipped=33, expected failures=1)
Test failed: <unittest.runner.TextTestResult run=1892 errors=0 failures=1>
error: Test failed: <unittest.runner.TextTestResult run=1892 errors=0 failures=1>
error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "python" arguments: ("-c" "import setuptools, tokenize;__file__='setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\\r\\n', '\\n');f.close();exec(compile(code, __file__, 'exec'))" "test") exit-status: 1 term-signal: #f stop-signal: #f>
phase `check' failed after 16.4 seconds
command "python" "-c" "import setuptools, tokenize;__file__='setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\\r\\n', '\\n');f.close();exec(compile(code, __file__, 'exec'))" "test" failed with status 1
builder for `/gnu/store/pgkjsi2i9yksi5cd4ymi9xpxbnnzlj7z-python-rope-1.1.1.drv' failed with exit code 1
build of /gnu/store/pgkjsi2i9yksi5cd4ymi9xpxbnnzlj7z-python-rope-1.1.1.drv failed
Could not find build log for '/gnu/store/pgkjsi2i9yksi5cd4ymi9xpxbnnzlj7z-python-rope-1.1.1.drv'.
guix build: error: build of `/gnu/store/pgkjsi2i9yksi5cd4ymi9xpxbnnzlj7z-python-rope-1.1.1.drv' failed
Hi @jgarte,
If you want to run rope's unittests, make sure you install the additional dev dependencies (i.e. pip installl rope[dev] or equivalent). This will install additional development dependencies that necessary when running tests, in particular build and pytest-timeout.
See setup.py (or in the future, pyproject.toml) for the full, most up to date list of additional dev dependencies.
Having said that, we might want to actually rewrite this test to not depend on build. This particular test do need to run against some third party libraries though, as it's testing autoimport of third party library and build just happens to be conveniently installed in the test system.
Maybe we can isolate this by rewriting the test to try to import something from pytest instead or to install a dummy package for the sole purpose of the test.
It requires a submodule to be there - ie the package must have more than one file. build is problematic because
- The user may not have it installed
- It only has two files
- Sometimes, pip/setuptools will create a build directory in sys.path and autoimport won't find build. That is a separate (but very rare) bug.
Pytest has a different issues:
- The only public module is main which doesn't have anything to import in it (and is ignored by autoimport)
- The private module _pytest is a bad idea because it is private and therefore unstable. Also autoimport ignores private modules by default.
Therefore, pytest won't satisfy the testing requirements.
This should be fixed now in #755.