New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error importing unittest: No module named xmlrunner #267

Closed
h1f1x opened this Issue Nov 23, 2015 · 7 comments

Comments

Projects
None yet
4 participants
@h1f1x

h1f1x commented Nov 23, 2015

If I replay the tutorial I get an error when I try to execute the first pyb with unit testing.

I attach the complete session (the full error is in the last lines):

$ virtualenv venv
New python executable in venv/bin/python
Installing setuptools, pip, wheel...done.
$ source venv/bin/activate
(venv)$ pip install pybuilder
Collecting pybuilder
Collecting tblib (from pybuilder)
Collecting six (from tblib->pybuilder)
  Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six, tblib, pybuilder
Successfully installed pybuilder-0.11.2 six-1.10.0 tblib-1.1.0
(venv)$ mkdir src/main/python
mkdir: src/main: No such file or directory
(venv)$ mkdir -p src/main/python
(venv)$ vim !$/helloworld.py
from mockito import mock, verify
vim src/main/python/helloworld.py
from pybuilder.core import init, use_plugin
(venv)$ vim build.py
(venv)$ pyb
PyBuilder version 0.11.2
Build started at 2015-11-23 17:57:26
------------------------------------------------------------
[INFO]  Building test_pyb version 1.0.dev0
[INFO]  Executing build in /data/home/fb/torkspace/test_pyb
[INFO]  Going to execute task publish
[INFO]  Building distribution in /data/home/fb/torkspace/test_pyb/target/dist/test_pyb-1.0.dev0
[INFO]  Copying scripts to /data/home/fb/torkspace/test_pyb/target/dist/test_pyb-1.0.dev0/scripts
------------------------------------------------------------
BUILD SUCCESSFUL
------------------------------------------------------------
Build Summary
             Project: test_pyb
             Version: 1.0.dev0
      Base directory: /data/home/fb/torkspace/test_pyb
        Environments:
               Tasks: prepare [0 ms] compile_sources [0 ms] run_unit_tests [0 ms] package [0 ms] run_integration_tests [0 ms] verify [0 ms] publish [0 ms]
Build finished at 2015-11-23 17:57:26
Build took 0 seconds (3 ms)
(venv)$ mkdir src/main/scripts
from pybuilder.core import init, use_plugin
(venv)$ vim src/main/scripts/hello-pybuilder
(venv)$ pyb
PyBuilder version 0.11.2
Build started at 2015-11-23 17:58:23
------------------------------------------------------------
[INFO]  Building test_pyb version 1.0.dev0
[INFO]  Executing build in /data/home/fb/torkspace/test_pyb
[INFO]  Going to execute task publish
[INFO]  Building distribution in /data/home/fb/torkspace/test_pyb/target/dist/test_pyb-1.0.dev0
[INFO]  Copying scripts to /data/home/fb/torkspace/test_pyb/target/dist/test_pyb-1.0.dev0/scripts
------------------------------------------------------------
BUILD SUCCESSFUL
------------------------------------------------------------
Build Summary
             Project: test_pyb
             Version: 1.0.dev0
      Base directory: /data/home/fb/torkspace/test_pyb
        Environments:
               Tasks: prepare [0 ms] compile_sources [0 ms] run_unit_tests [0 ms] package [1 ms] run_integration_tests [0 ms] verify [0 ms] publish [0 ms]
Build finished at 2015-11-23 17:58:23
Build took 0 seconds (3 ms)
(venv)$ mkdir -p src/unittest/python/
(venv)$ vim src/unittest/python/helloworld_tests.py
(venv)$ vim build.py
(venv)$ pyb install_dependencies
PyBuilder version 0.11.2
Build started at 2015-11-23 17:59:01
------------------------------------------------------------
[INFO]  Building test_pyb version 1.0.dev0
[INFO]  Executing build in /data/home/fb/torkspace/test_pyb
[INFO]  Going to execute task install_dependencies
[INFO]  Installing all dependencies
[INFO]  Installing build dependencies
[INFO]  Installing dependency 'mockito'
[INFO]  Installing runtime dependencies
------------------------------------------------------------
BUILD SUCCESSFUL
------------------------------------------------------------
Build Summary
             Project: test_pyb
             Version: 1.0.dev0
      Base directory: /data/home/fb/torkspace/test_pyb
        Environments:
               Tasks: install_dependencies [2575 ms]
Build finished at 2015-11-23 17:59:04
Build took 2 seconds (2578 ms)
(venv)$ vim build.py
(venv)$ pyb
PyBuilder version 0.11.2
Build started at 2015-11-23 17:59:25
------------------------------------------------------------
[INFO]  Building test_pyb version 1.0.dev0
[INFO]  Executing build in /data/home/fb/torkspace/test_pyb
[INFO]  Going to execute task publish
[INFO]  Running unit tests
[INFO]  Executing unit tests from Python modules in /data/home/fb/torkspace/test_pyb/src/unittest/python
[ERROR] Import error in test file /data/home/fb/torkspace/test_pyb/venv/lib/python2.7/site-packages/pybuilder/plugins/python/unittest_plugin.py, due to statement 'lambda stream: __import__("xmlrunner").XMLTestRunner(output=project.expand_path("$dir_target/reports"),' on line 49
[ERROR] Error importing unittest: No module named xmlrunner
------------------------------------------------------------
BUILD FAILED - Unable to execute unit tests.
------------------------------------------------------------
Build finished at 2015-11-23 17:59:26
Build took 0 seconds (242 ms)
(venv)$
@esc

This comment has been minimized.

Show comment
Hide comment
@esc

esc Nov 23, 2015

Member

pyb install_dependencies didn't install the xmlrunner??

Member

esc commented Nov 23, 2015

pyb install_dependencies didn't install the xmlrunner??

@arcivanov

This comment has been minimized.

Show comment
Hide comment

@arcivanov arcivanov added this to the v0.11.3 milestone Nov 23, 2015

@arcivanov arcivanov self-assigned this Nov 23, 2015

@arcivanov arcivanov added the bug label Nov 23, 2015

arcivanov added a commit to arcivanov/pybuilder that referenced this issue Nov 23, 2015

@arcivanov

This comment has been minimized.

Show comment
Hide comment
@arcivanov

arcivanov Nov 23, 2015

Contributor

Workaround is:

(venv)$ pip install unittest-xml-reporting
Contributor

arcivanov commented Nov 23, 2015

Workaround is:

(venv)$ pip install unittest-xml-reporting

@arcivanov arcivanov closed this in #268 Nov 23, 2015

@arcivanov arcivanov removed the in progress label Nov 23, 2015

@arcivanov

This comment has been minimized.

Show comment
Hide comment
@arcivanov

arcivanov Nov 23, 2015

Contributor

Fixed as of 0.11.3.dev20151123211844. Please use

(venv)$ pip install --upgrade --pre pybuilder
Contributor

arcivanov commented Nov 23, 2015

Fixed as of 0.11.3.dev20151123211844. Please use

(venv)$ pip install --upgrade --pre pybuilder
@UzLA

This comment has been minimized.

Show comment
Hide comment
@UzLA

UzLA Nov 19, 2016

Problem persists pyb:
[ERROR] Import error in test file /usr/local/lib/python3.5/dist-packages/pybuilder/plugins/python/unittest_plugin.py, due to statement 'lambda stream: import("xmlrunner").XMLTestRunner(output=project.expand_path("$dir_target/reports"),' on line 54
[ERROR] Error importing unittest: No module named 'xmlrunner'
Environment:
Linux 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux (Ubuntu 16.04)
pip 9.0.1 from /usr/local/lib/python3.5/dist-packages (python 3.5)
pyb 0.11.9

build.py has the following line:
use_plugin("python.install_dependencies")

pip install unittest-xml-reporting ineeded fixes the problem as workaround, but problem as such seems not to be resolved.

UzLA commented Nov 19, 2016

Problem persists pyb:
[ERROR] Import error in test file /usr/local/lib/python3.5/dist-packages/pybuilder/plugins/python/unittest_plugin.py, due to statement 'lambda stream: import("xmlrunner").XMLTestRunner(output=project.expand_path("$dir_target/reports"),' on line 54
[ERROR] Error importing unittest: No module named 'xmlrunner'
Environment:
Linux 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux (Ubuntu 16.04)
pip 9.0.1 from /usr/local/lib/python3.5/dist-packages (python 3.5)
pyb 0.11.9

build.py has the following line:
use_plugin("python.install_dependencies")

pip install unittest-xml-reporting ineeded fixes the problem as workaround, but problem as such seems not to be resolved.

@arcivanov

This comment has been minimized.

Show comment
Hide comment
@arcivanov

arcivanov Nov 19, 2016

Contributor

@UzLA It doesn't ;)

[ERROR] Import error in test file **/usr/local/lib/**python3.5/dist-packages/pybuilder/plugins/python/unittest_plugin.py

Unless you're running PyB as root/with sudo, PyB cannot install necessary plugins into /usr/local/lib.

Contributor

arcivanov commented Nov 19, 2016

@UzLA It doesn't ;)

[ERROR] Import error in test file **/usr/local/lib/**python3.5/dist-packages/pybuilder/plugins/python/unittest_plugin.py

Unless you're running PyB as root/with sudo, PyB cannot install necessary plugins into /usr/local/lib.

@UzLA

This comment has been minimized.

Show comment
Hide comment
@UzLA

UzLA Nov 19, 2016

Fair point! It is not an issue! And thanks for prompt response!

UzLA commented Nov 19, 2016

Fair point! It is not an issue! And thanks for prompt response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment