This is really a Python issue, not Jenkins. But here's how I do it.
PYTHONPATH environment variable is automatically appended to sys.path in
Python. So in your Python script, just directly add the relevant
directory (can be a relative or absolute path):
import sys
sys.path.append('path/to/my_dir')
Eric
On 12/20/2016 3:19 PM, Omeka wrote:
hello,
i am looking for a way to set PYTHONPATH to the workspace / current
directory of a build that executes unit test with pytest and avoid
the following
error messages:
[Tests] ______________ ERROR collecting tests/unit/drive/test_config.py
_______________
[Tests] tests/unit/drive/test_config.py:3: in <module>
[Tests] from drive import config
[Tests] E ImportError: No module named 'drive'
[Tests] ______________ ERROR collecting tests/unit/drive/test_helpers.py
______________
[Tests] tests/unit/drive/test_helpers.py:3: in <module>
[Tests] from drive import helpers
[Tests] E ImportError: No module named 'drive'
[Tests] ______________ ERROR collecting tests/unit/drive/test_service.py
______________
[Tests] tests/unit/drive/test_service.py:5: in <module>
[Tests] from drive import service
[Tests] E ImportError: No module named 'drive'
[Tests] ___________ ERROR collecting tests/unit/drive/test_transformers.py
____________
[Tests] tests/unit/drive/test_transformers.py:5: in <module>
[Tests] from drive import transformers
[Tests] E ImportError: No module named 'drive'
[Tests] =========================== 4 error in 0.25 seconds
============================
the build is excuted in docker container based on the official python
3.5 image
I have to admit i have been playing with python for about just two
weeks so i might be missing something.
Best regards
Omeka
--
You received this message because you are subscribed to the Google
Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/c3a15a5c-011c-4986-b1d3-cfc669a87804%40googlegroups.com
<https://groups.google.com/d/msgid/jenkinsci-users/c3a15a5c-011c-4986-b1d3-cfc669a87804%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
*Eric Pyle
*
Release Engineer
Lebanon
+1 603-277-3060 (T)
+1 603-359-8670 (M)
[email protected] <mailto:[email protected]>
http://www.cd-adapco.com <http://www.cd-adapco.com>
--
You received this message because you are subscribed to the Google Groups "Jenkins
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/463fd169-52d3-0f52-19c5-954028d03702%40cd-adapco.com.
For more options, visit https://groups.google.com/d/optout.