Запускаю Jenkins на локальной машине, при запуске возникает ошибка которая указывает на то что python берется локально, а не из virtualenv. Подскажите как и где его правильно указать в настройках
А сделать source /path/to/your/venv/bin/activate первым шагом перед запуском тестов религия не позволяет?
При запуске прописал, все ок, выводит это в консоль. Но ошибку выводит по локальному пути, а не в мой virtualenv :
- source config/bin/activate
++ deactivate nondestructive
++ unset -f pydoc
++ ‘[’ -z ‘’ ‘]’
++ ‘[’ -z ‘’ ‘]’
++ ‘[’ -n /bin/sh ‘]’
++ hash -r
++ ‘[’ -z ‘’ ‘]’
++ unset VIRTUAL_ENV
++ ‘[’ ‘!’ nondestructive = nondestructive ‘]’
++ VIRTUAL_ENV=/Users/user/Desktop/autotesting2/config
++ export VIRTUAL_ENV
++ _OLD_VIRTUAL_PATH=/usr/bin:/bin:/usr/sbin:/sbin
++ PATH=/Users/user/Desktop/autotesting2/config/bin:/usr/bin:/bin:/usr/sbin:/sbin
++ export PATH
++ ‘[’ -z ‘’ ‘]’
++ ‘[’ -z ‘’ ‘]’
++ _OLD_VIRTUAL_PS1=
++ ‘[’ x ‘!=’ x ‘]’
+++ basename /Users/user/Desktop/autotesting2/config
++ PS1=’(config) ’
++ export PS1
++ alias pydoc
++ ‘[’ -n /bin/sh ‘]’
++ hash -r - python2.7 -m pytest case.py --alluredir=report
Traceback (most recent call last):
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
“main”, fname, loader, pkg_name)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/Library/Python/2.7/site-packages/pytest.py”, line 73, in
raise SystemExit(pytest.main())
File “/Library/Python/2.7/site-packages/_pytest/config.py”, line 49, in main
config = _prepareconfig(args, plugins)
File “/Library/Python/2.7/site-packages/_pytest/config.py”, line 158, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 745, in call
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 334, in
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 613, in execute
return _wrapped_call(hook_impl.function(*args), self.execute)
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 250, in _wrapped_call
wrap_controller.send(call_outcome)
File “/Library/Python/2.7/site-packages/_pytest/helpconfig.py”, line 34, in pytest_cmdline_parse
config = outcome.get_result()
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 280, in get_result
_reraise(*ex) # noqa
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 265, in init
self.result = func()
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 614, in execute
res = hook_impl.function(*args)
File “/Library/Python/2.7/site-packages/_pytest/config.py”, line 928, in pytest_cmdline_parse
self.parse(args)
File “/Library/Python/2.7/site-packages/_pytest/config.py”, line 1100, in parse
self._preparse(args, addopts=addopts)
File “/Library/Python/2.7/site-packages/_pytest/config.py”, line 1062, in _preparse
self.pluginmanager.load_setuptools_entrypoints(‘pytest11’)
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 516, in load_setuptools_entrypoints
self.register(plugin, name=ep.name)
File “/Library/Python/2.7/site-packages/_pytest/config.py”, line 252, in register
ret = super(PytestPluginManager, self).register(plugin, name)
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 371, in register
hook._maybe_apply_history(hookimpl)
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 768, in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 334, in
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File “/Library/Python/2.7/site-packages/_pytest/vendored_packages/pluggy.py”, line 614, in execute
res = hook_impl.function(*args)
File "/Library/Python/2.7/site-packages/allure_pytest/plugin.py", line 33, in pytest_addoption
severities = [x.value for x in list(allure.severity_level)]
AttributeError: ‘module’ object has no attribute ‘severity_level’
Build step ‘Execute shell’ marked build as failure
Возможно надо где-то, как-то прописать virtualenv --no-site-packages config/
Где config/ - дериктория virtualenv
Решил проблему, при запуске надо ясно указывать python из виртуального окружения
К примеру
config/bin/python -m pytest case.py --alluredir=report