2

I have a project being built with Pybuilder. I cloned it onto a new computer, and when I ran pyb, my unit tests complained that there was no module named xmlrunner. So after I did pip install xmlrunner, I get a build error from Pybuilder that:

'unicode' object has no attribute 'write'.

If I remove my unit tests from the unittest search path, the build completes successfully. When I run the unit tests directly, they complete successfully. So I'm thinking that somehow XMLRunner is failing. Pip installed XMLRunner version 1.7.7. Thanks in advance for your help.

GrahamGoudeau
  • 137
  • 2
  • 10

2 Answers2

1

I seemed to have got this working by doing the following:

First I got the same error as you:

BUILD FAILED - 'unicode' object has no attribute 'write'

Then I uninstalled xmlrunner & unittest-xml-reporting using pip

Then I used pyb install_dependencies which reinstalls unittest-xml-reporting

Then my unit tests start running again when I use pyb:

There were 1 error(s) and 0 failure(s) in unit tests

This is my current pip list output:

pip (7.1.2)

PyBuilder (0.11.1)

setuptools (18.2)

six (1.9.0)

tblib (1.1.0)

unittest-xml-reporting (1.12.0)

wheel (0.24.0)

If you are using virtualenv, you can also get this error when you have pybuilder installed outside of your virtualenv environment:

For example, your virtualenv does not have pybuilder installed, but you can still run pyb from command line. It is this pybuilder that needs to be removed as well (I am on OSX so it was the default python that came with it)

Shiraaz.M
  • 3,073
  • 2
  • 24
  • 40
0

The issue was resolved for me when I downgraded PyBuilder to 0.10.63 from 0.11.0. In their release notes (here: http://pybuilder.github.io/releasenotes/) for that 0.10.63, they mention "Fixed a regression introduced in 0.10.62 where the unit test reports generated by the python.unittest plugin would always be empty."

For some reason this fixed it completely for me.

GrahamGoudeau
  • 137
  • 2
  • 10