1

Running the unit tests normally works and passes all the tests, but when trying to build using pybuilder it gives me a Build Error:

BUILD FAILED - There were 1 error(s) and 0 failure(s) in unit tests (site-packages/pybuilder/plugins/python/unittest_plugin.py:114)

Build Failed message

This was caused by the unit test not finding the module it was meant to test.

File layout:

.
├── main
│   ├── python
│   │   ├── __pycache__
│   │   │   └── utils.cpython-36.pyc
│   │   └── utils.py
│   └── scripts
│       ├── project.py
│       └── __pycache__
│           └── project.cpython-36.pyc
└── unittest
    └── python
        ├── project_tests.py
        ├── __pycache__
        │   ├── project_tests.cpython-36.pyc
        │   └── utils_tests.cpython-36.pyc
        └── utils_tests.py

Currently I am importing the module project by:

import sys
sys.path.insert(0, '../../main/scripts')
import project

First post and also not a pro Python programmer so I apologize if I missed something to post and/or it is an obvious solution. I am on Ubuntu 18.04.

Thank you.

Kyle Cintron
  • 316
  • 2
  • 6

1 Answers1

0

I'm kinda late, but i'll just leave it here in case someone needs it : Usually the pybuilder takes the src/main/python/ folder as the default directory for your scripts, if you want your code to work without adding the os.path.insert(...) change the default path (you can find a way to change it in this answer answer )

mrCopiCat
  • 899
  • 3
  • 15