Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named _testcapi

Just create virtualenv on Centos7 and try to run unittests for my app.

   $ cat /etc/redhat-release
    CentOS Linux release 7.1.1503 (Core)

    $ python -V
    Python 2.7.5

    gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9)

    $ py.test -v .
    ...

    $ py.test -v .
    platform linux2 -- Python 2.7.5, pytest-2.8.2, py-1.4.30, pluggy-0.3.1 

    ERROR collecting tests/test_config_and_start_up.py 
    tests/test_config_and_start_up.py:11: in <module>
        from test.test_support import EnvironmentVarGuard
    ../../../../.virtualenvs/c/lib/python2.7/site-        packages/_pytest/assertion/rewrite.py:171: in load_module
        py.builtin.exec_(co, mod.__dict__)
    /usr/lib64/python2.7/test/test_support.py:22: in <module>
        import _testcapi
    E   ImportError: No module named _testcapi

The same resualt with nosetest. Any ideas how to fix or workaround this issue?

like image 496
greggyNapalm Avatar asked Oct 16 '15 21:10

greggyNapalm


1 Answers

Install python-test package. As root user issue:

yum install python-test

@hoefling: FC32

dnf install python3-test
like image 131
fassl Avatar answered Oct 25 '22 22:10

fassl