allure-framework / allure-pytest Goto Github PK
View Code? Open in Web Editor NEWDeprecated, please use https://github.com/allure-framework/allure-python instead
License: Other
Deprecated, please use https://github.com/allure-framework/allure-python instead
License: Other
Working bug demo:
https://github.com/tarvitz/python-allure-demo#issue-41
Short story:
pytest works with doctests fine and proper but when I want to make a allure report from these tests i get this
platform linux2 -- Python 2.7.6 -- py-1.4.25 -- pytest-2.6.3
plugins: gae, allure-adaptor
collected 1 items
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/home/nfox/www/ve/local/lib/python2.7/site-packages/_pytest/main.py", line 84, in wrap_session
INTERNALERROR> doit(config, session)
INTERNALERROR> File "/home/nfox/www/ve/local/lib/python2.7/site-packages/_pytest/main.py", line 122, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/home/nfox/www/ve/local/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "/home/nfox/www/ve/local/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "/home/nfox/www/ve/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "/home/nfox/www/ve/local/lib/python2.7/site-packages/_pytest/main.py", line 142, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File "/home/nfox/www/ve/local/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "/home/nfox/www/ve/local/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "/home/nfox/www/ve/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "/home/nfox/www/ve/local/lib/python2.7/site-packages/allure/pytest_plugin.py", line 269, in pytest_runtest_protocol
INTERNALERROR> module = parent_module(item)
INTERNALERROR> File "/home/nfox/www/ve/local/lib/python2.7/site-packages/allure/utils.py", line 37, in parent_module
INTERNALERROR> return filter(lambda x: isinstance(x, Module), parents_of(item))[0]
INTERNALERROR> IndexError: list index out of range
pytest version installed is 2.6, but test is reporting as version conflict.
if require: self.require(env, installer)
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2100, in require
working_set.resolve(self.dist.requires(self.extras),env,installer)))
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 632, in resolve
raise VersionConflict(dist,req) # XXX put more info here
pkg_resources.VersionConflict: (py 1.4.20 (/usr/lib/python2.7/dist-packages), Requirement.parse('py>=1.4.22'))
raghu@raghu-VirtualBox:~/PycharmProjects/securehomegateway-automation$ pip list | grep pytest
The directory '/home/raghu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
You are using pip version 7.0.3, however version 7.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
pytest (2.6.1)
pytest-sugar (0.4.0)
pytest-xdist (1.12)
E.g.:
def test_smth(data):
pytest.allure.set_severity(pytest.allure.severity_level.MINOR)
assert 1
Collecting pytest-allure-adaptor
Downloading pytest-allure-adaptor-1.6.2.tar.gz
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "C:\Users\N2FD7~1.GOS\AppData\Local\Temp\pip-build-8o9bhxjx\pytest-al
lure-adaptor\setup.py", line 33, in <module>
main()
File "C:\Users\N2FD7~1.GOS\AppData\Local\Temp\pip-build-8o9bhxjx\pytest-al
lure-adaptor\setup.py", line 22, in main
long_description=read('README.rst'),
File "C:\Users\N2FD7~1.GOS\AppData\Local\Temp\pip-build-8o9bhxjx\pytest-al
lure-adaptor\setup.py", line 10, in read
return open(os.path.join(os.path.dirname(__file__), fname)).read()
File "C:\Python34\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 5457:
character maps to <undefined>
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "C:\Users\N2FD7~1.GOS\AppData\Local\Temp\pip-build-8o9bhxjx\pytest-al
lure-adaptor\setup.py", line 33, in <module>
main()
File "C:\Users\N2FD7~1.GOS\AppData\Local\Temp\pip-build-8o9bhxjx\pytest-al
lure-adaptor\setup.py", line 22, in main
long_description=read('README.rst'),
File "C:\Users\N2FD7~1.GOS\AppData\Local\Temp\pip-build-8o9bhxjx\pytest-al
lure-adaptor\setup.py", line 10, in read
return open(os.path.join(os.path.dirname(__file__), fname)).read()
File "C:\Python34\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 5457:
character maps to <undefined>
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\N2FD
7~1.GOS\AppData\Local\Temp\pip-build-8o9bhxjx\pytest-allure-adaptor
Hello folks!
I'm very glad that #8 issue was resolved. Seems to be it take 2 years from now :)
But, still, I got the error.
============================= test session starts ==============================
platform linux -- Python 3.4.3, pytest-2.8.7, py-1.4.31, pluggy-0.3.1 -- /home/alexander-momot/Code/pytest-selenium-pgu/env/bin/python3
cachedir: .cache
rootdir: /home/alexander-momot/Code/pytest-selenium-pgu, inifile: pytest.ini
plugins: variables-1.3, xdist-1.14, allure-adaptor-1.7.1
gw0 I
[gw0] linux Python 3.4.3 cwd: /home/alexander-momot/Code/pytest-selenium-pgu
[gw0] Python 3.4.3 (default, Oct 14 2015, 20:33:09) -- [GCC 4.8.4]
gw0 [1]
scheduling tests via LoadScheduling
some/tests/beta/service/mymodulewithsuits.py::SomeSanitySuite::check_correct_values_case
[gw0] PASSED some/tests/beta/service/mymodulewithsuits.py::SomeSanitySuite::check_correct_values_case
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/_pytest/main.py", line 90, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/_pytest/main.py", line 121, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/_pytest/vendored_packages/pluggy.py", line 724, in __call__
INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/_pytest/vendored_packages/pluggy.py", line 596, in execute
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/xdist/dsession.py", line 536, in pytest_runtestloop
INTERNALERROR> self.loop_once()
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/xdist/dsession.py", line 554, in loop_once
INTERNALERROR> call(**kwargs)
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/xdist/dsession.py", line 663, in slave_testreport
INTERNALERROR> self.config.hook.pytest_runtest_logreport(report=rep)
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/_pytest/vendored_packages/pluggy.py", line 724, in __call__
INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/_pytest/vendored_packages/pluggy.py", line 596, in execute
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/allure/pytest_plugin.py", line 501, in pytest_runtest_logreport
INTERNALERROR> for a in testcase.iter_attachments():
INTERNALERROR> File "/home/alexander-momot/Code/pytest-selenium-pgu/env/lib/python3.4/site-packages/allure/structure.py", line 38, in iter_attachments
INTERNALERROR> for a in self.attachments:
INTERNALERROR> TypeError: 'NoneType' object is not iterable
My configuration is : venv with python 3.4.3 installed, latest version of the pytest and allure. Ubuntu 14.04 x86. Requirements installed:
apipkg==1.4
enum34==1.1.2
execnet==1.4.1
lxml==3.5.0
namedlist==1.7
Pillow==3.1.1
psutil==4.0.0
py==1.4.31
pytest==2.8.7
pytest-allure-adaptor==1.7.1
pytest-variables==1.3
pytest-xdist==1.14
pytractor==0.2.1
requests==2.9.1
selenium==2.52.0
six==1.10.0
TestLink-API-Python-client==0.6.2
wheel==0.29.0
pytest.ini contents:
[pytest]
minversion = 2.8.7
norecursedirs = env _build tmp*
testpaths = some/tests
python_files = *.py
python_classes = *Suite*
python_functions = *case*
#log_format = %(asctime)s %(levelname)s %(message)s
#log_date_format = %Y-%m-%d %H:%M:%S
addopts = --result-log=text-reports/report.log --junit-prefix=pref --junitxml=xml-reports/report.xml --capture=sys --strict --cache-clear --alluredir=html-reports
#sensitive_url = http://example.com
#base_url = http://example.com/
#selenium_capture_debug = always
#testlink_ini_file = testlink.ini
Enter point script is:
/home/alexander-momot/Code/pytest-selenium-pgu/pytest-runner.py
Running as:
some/tests/beta/service/case.py --base-url=http://example.com --tb=short --durations=20 --maxfail=20 -v -l --assert=reinterp -n 1
Say, I have my own custom email reporting plugin that allure is dependent upon. How do I specify this dependency in allure? Somewhere in setup.py? If yes, like just putting the custom plugin name in "install_requires" list?
Any help is appreciated.
Пример: не работает запуск --allure_features=названиефичи
I have found that you have some special configuration on your jenkins slave because almost all tests fall on travis https://travis-ci.org/F1ashhimself/allure-python/builds/23922236
Could you please investigate this issue for further pull request #18 processing.
There are 2 tests in module: 1 with xfail and 1 with skip.
Run tests on py.test.
Open allure report.
Result: there are 2 tests marked Cancel.
ExpResult: xfail test marked Pending, skip test marked Cancel.
When generating a report, pytest-allure-adaptor returns the following XML file.
<test-cases>
<test-case start="1459432344326" status="passed" stop="1459432471926">
<name>My first test</name>
<description>This is the description</description>
....
I noticed there's no description-type, and from the documentation, I couldn't find a way to add markdown to my descriptions. I've talked with @baev and he suggested I open an issue. Having this feature would be great for our group.
Thank you :)
Lettuce is a BDD framework for python and it would be really good to have allure support that
Неплохо было бы иметь, что-то подобное:
with assert_step(expected, result):
self.assertEqual(expected, result, "values aren't equal")
=>
allure message "Checking that expected is equal result"
Hi. I'm learning Python and would like to write a test suite using pytest-bdd that reports with Allure. Is there any reason to think pytest-bdd would not be compatible with allure-python?
https://pypi.python.org/pypi/pytest-bdd
https://github.com/pytest-dev/pytest-bdd
http://developer.paylogic.com/articles/how-we-use-pytest-and-pytest-bdd-in-paylogic.html
I'm particularly interested in reporting Jmeter-like statistics from this test suite. Here are some stats I'm looking to generate: http://www.quora.com/How-do-we-analyze-reports-in-JMeter/answers/9712920
Thanks!
Hi,
I'm getting import error with new version of allure-python:
File "/usr/local/lib/python2.7/dist-packages/allure/utils.py", line 11, in <module>
from six import text_type, binary_type, python_2_unicode_compatible, u
ImportError: cannot import name python_2_unicode_compatible
Six 1.9.0 with python 2.7 is installed.
Version 1.5.2 is working.
Regards,
It would be nice if we have integration with Behave(http://pythonhosted.org/behave/)
Already tried with Allure CLI + Behave Junit XML Generation
What I did:
I already tried to generate junit xml with
behave --junit
The default folder of junit xml generation is reports/
then
allure generate reports/
allure open
Open the allure reports without any information about the behave test steps, unit tests and behaviour either.
Would be nice if has a plugin(allure-behave) to auto-discover features and scenarios, automatically fill up allure tabs with information, from High-Level BDD Tests(Acceptance tests) to Low-Level BDD Unit Tests.
It would be beautiful. :D
What do you think guys ?
Возможно ли, по аналогии с @allure.step, динамически передавать значение в @allure.testcase?
Например в параметризированном тесте, который генерирует несколько тестов.
So far pytest-allure-adaptor is not working with the latest pytest 2.9.2.
Could you please fix it?
Thank you.
@pytest.allure.feature('заказ')
@pytest.allure.story('Создание заказа')
platform linux2 -- Python 2.7.6 -- py-1.4.25 -- pytest-2.6.3
plugins: allure-adaptor, xdist, bdd
collected 1 items
tests/site_tests/tests/test_tms_599.py F
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/main.py", line 84, in wrap_session
INTERNALERROR> doit(config, session)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/main.py", line 122, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/main.py", line 142, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/pytest_plugin.py", line 285, in pytest_runtest_protocol
INTERNALERROR> self.impl.stop_suite()
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/common.py", line 180, in stop_suite
INTERNALERROR> self._write_suite(f, self.testsuite)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/common.py", line 221, in _write_suite
INTERNALERROR> logfile.write(etree.tostring(suite.toxml(), pretty_print=True, xml_declaration=False, encoding=unicode))
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 113, in toxml
INTERNALERROR> manys = sum([[(m[0], v) for v in m[1]] for m in entries(Many)], [])
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 108, in <lambda>
INTERNALERROR> entries = lambda clazz: [(name, rule.value(name, getattr(self, name))) for (name, rule) in items if isinstance(rule, clazz) and rule.check(getattr(self, name))]
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 99, in value
INTERNALERROR> return el(*[self.rule.value(name, x) for x in what])
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 87, in value
INTERNALERROR> return what.toxml()
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 113, in toxml
INTERNALERROR> manys = sum([[(m[0], v) for v in m[1]] for m in entries(Many)], [])
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 108, in <lambda>
INTERNALERROR> entries = lambda clazz: [(name, rule.value(name, getattr(self, name))) for (name, rule) in items if isinstance(rule, clazz) and rule.check(getattr(self, name))]
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 99, in value
INTERNALERROR> return el(*[self.rule.value(name, x) for x in what])
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 87, in value
INTERNALERROR> return what.toxml()
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 116, in toxml
INTERNALERROR> **{name: attr for (name, attr) in attributes})
INTERNALERROR> File "lxml.objectify.pyx", line 1129, in lxml.objectify._ObjectifyElementMakerCaller.__call__ (src/lxml/lxml.objectify.c:16479)
INTERNALERROR> File "lxml.objectify.pyx", line 1778, in lxml.objectify._makeElement (src/lxml/lxml.objectify.c:23128)
INTERNALERROR> File "public-api.pxi", line 27, in lxml.etree.makeElement (src/lxml/lxml.etree.c:177888)
INTERNALERROR> File "apihelpers.pxi", line 140, in lxml.etree._makeElement (src/lxml/lxml.etree.c:15242)
INTERNALERROR> File "apihelpers.pxi", line 128, in lxml.etree._makeElement (src/lxml/lxml.etree.c:15125)
INTERNALERROR> File "apihelpers.pxi", line 287, in lxml.etree._initNodeAttributes (src/lxml/lxml.etree.c:17030)
INTERNALERROR> File "apihelpers.pxi", line 297, in lxml.etree._addAttributeToNode (src/lxml/lxml.etree.c:17210)
INTERNALERROR> File "apihelpers.pxi", line 1393, in lxml.etree._utf8 (src/lxml/lxml.etree.c:27171)
INTERNALERROR> ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters
Traceback (most recent call last):
File "/home/aohontsev/Projects/autotests-framework/autotest_framework.py", line 8, in <module>
raise SystemExit(autotest_framework.main())
File "/home/aohontsev/Projects/autotests-framework/modules/main.py", line 63, in main
start_tests(args.tests_path)
File "/home/aohontsev/Projects/autotests-framework/modules/start.py", line 23, in start_tests
pytest.main(args=args)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/config.py", line 41, in main
return config.hook.pytest_cmdline_main(config=config)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
return self._docall(methods, kwargs)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
res = mc.execute()
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
res = method(**kwargs)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/main.py", line 116, in pytest_cmdline_main
return wrap_session(config, _main)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/main.py", line 109, in wrap_session
exitstatus=session.exitstatus)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
return self._docall(methods, kwargs)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
res = mc.execute()
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
res = method(**kwargs)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/terminal.py", line 349, in pytest_sessionfinish
__multicall__.execute()
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
res = method(**kwargs)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/pytest_plugin.py", line 315, in pytest_sessionfinish
self.impl.stop_suite()
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/common.py", line 180, in stop_suite
self._write_suite(f, self.testsuite)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/common.py", line 221, in _write_suite
logfile.write(etree.tostring(suite.toxml(), pretty_print=True, xml_declaration=False, encoding=unicode))
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 113, in toxml
manys = sum([[(m[0], v) for v in m[1]] for m in entries(Many)], [])
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 108, in <lambda>
entries = lambda clazz: [(name, rule.value(name, getattr(self, name))) for (name, rule) in items if isinstance(rule, clazz) and rule.check(getattr(self, name))]
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 99, in value
return el(*[self.rule.value(name, x) for x in what])
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 87, in value
return what.toxml()
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 113, in toxml
manys = sum([[(m[0], v) for v in m[1]] for m in entries(Many)], [])
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 108, in <lambda>
entries = lambda clazz: [(name, rule.value(name, getattr(self, name))) for (name, rule) in items if isinstance(rule, clazz) and rule.check(getattr(self, name))]
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 99, in value
return el(*[self.rule.value(name, x) for x in what])
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 87, in value
return what.toxml()
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 116, in toxml
**{name: attr for (name, attr) in attributes})
File "lxml.objectify.pyx", line 1129, in lxml.objectify._ObjectifyElementMakerCaller.__call__ (src/lxml/lxml.objectify.c:16479)
File "lxml.objectify.pyx", line 1778, in lxml.objectify._makeElement (src/lxml/lxml.objectify.c:23128)
File "public-api.pxi", line 27, in lxml.etree.makeElement (src/lxml/lxml.etree.c:177888)
File "apihelpers.pxi", line 140, in lxml.etree._makeElement (src/lxml/lxml.etree.c:15242)
File "apihelpers.pxi", line 128, in lxml.etree._makeElement (src/lxml/lxml.etree.c:15125)
File "apihelpers.pxi", line 287, in lxml.etree._initNodeAttributes (src/lxml/lxml.etree.c:17030)
File "apihelpers.pxi", line 297, in lxml.etree._addAttributeToNode (src/lxml/lxml.etree.c:17210)
File "apihelpers.pxi", line 1393, in lxml.etree._utf8 (src/lxml/lxml.etree.c:27171)
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/__init__.py", line 872, in emit
stream.write(fs % msg)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/capture.py", line 234, in write
self.buffer.write(obj)
ValueError: I/O operation on closed file
Logged from file ssh.py, line 95
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/__init__.py", line 872, in emit
stream.write(fs % msg)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/capture.py", line 234, in write
self.buffer.write(obj)
ValueError: I/O operation on closed file
Logged from file database.py, line 87
Process finished with exit code 1
and another case
@pytest.allure.feature(u'заказ')
@pytest.allure.story(u'Создание заказа')
platform linux2 -- Python 2.7.6 -- py-1.4.25 -- pytest-2.6.3
plugins: allure-adaptor, xdist, bdd
collected 1 items
tests/site_tests/tests/test_tms_599.py F
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/main.py", line 84, in wrap_session
INTERNALERROR> doit(config, session)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/main.py", line 122, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/main.py", line 142, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/pytest_plugin.py", line 285, in pytest_runtest_protocol
INTERNALERROR> self.impl.stop_suite()
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/common.py", line 180, in stop_suite
INTERNALERROR> self._write_suite(f, self.testsuite)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/common.py", line 221, in _write_suite
INTERNALERROR> logfile.write(etree.tostring(suite.toxml(), pretty_print=True, xml_declaration=False, encoding=unicode))
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 113, in toxml
INTERNALERROR> manys = sum([[(m[0], v) for v in m[1]] for m in entries(Many)], [])
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 108, in <lambda>
INTERNALERROR> entries = lambda clazz: [(name, rule.value(name, getattr(self, name))) for (name, rule) in items if isinstance(rule, clazz) and rule.check(getattr(self, name))]
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 99, in value
INTERNALERROR> return el(*[self.rule.value(name, x) for x in what])
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 87, in value
INTERNALERROR> return what.toxml()
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 113, in toxml
INTERNALERROR> manys = sum([[(m[0], v) for v in m[1]] for m in entries(Many)], [])
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 108, in <lambda>
INTERNALERROR> entries = lambda clazz: [(name, rule.value(name, getattr(self, name))) for (name, rule) in items if isinstance(rule, clazz) and rule.check(getattr(self, name))]
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 99, in value
INTERNALERROR> return el(*[self.rule.value(name, x) for x in what])
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 87, in value
INTERNALERROR> return what.toxml()
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 111, in toxml
INTERNALERROR> attributes = entries(Attribute)
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 108, in <lambda>
INTERNALERROR> entries = lambda clazz: [(name, rule.value(name, getattr(self, name))) for (name, rule) in items if isinstance(rule, clazz) and rule.check(getattr(self, name))]
INTERNALERROR> File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 82, in value
INTERNALERROR> return str(what)
INTERNALERROR> UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7: ordinal not in range(128)
Traceback (most recent call last):
File "/home/aohontsev/Projects/autotests-framework/autotest_framework.py", line 8, in <module>
raise SystemExit(autotest_framework.main())
File "/home/aohontsev/Projects/autotests-framework/modules/main.py", line 63, in main
start_tests(args.tests_path)
File "/home/aohontsev/Projects/autotests-framework/modules/start.py", line 23, in start_tests
pytest.main(args=args)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/config.py", line 41, in main
return config.hook.pytest_cmdline_main(config=config)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
return self._docall(methods, kwargs)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
res = mc.execute()
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
res = method(**kwargs)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/main.py", line 116, in pytest_cmdline_main
return wrap_session(config, _main)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/main.py", line 109, in wrap_session
exitstatus=session.exitstatus)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
return self._docall(methods, kwargs)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
res = mc.execute()
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
res = method(**kwargs)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/terminal.py", line 349, in pytest_sessionfinish
__multicall__.execute()
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
res = method(**kwargs)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/pytest_plugin.py", line 315, in pytest_sessionfinish
self.impl.stop_suite()
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/common.py", line 180, in stop_suite
self._write_suite(f, self.testsuite)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/common.py", line 221, in _write_suite
logfile.write(etree.tostring(suite.toxml(), pretty_print=True, xml_declaration=False, encoding=unicode))
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 113, in toxml
manys = sum([[(m[0], v) for v in m[1]] for m in entries(Many)], [])
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 108, in <lambda>
entries = lambda clazz: [(name, rule.value(name, getattr(self, name))) for (name, rule) in items if isinstance(rule, clazz) and rule.check(getattr(self, name))]
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 99, in value
return el(*[self.rule.value(name, x) for x in what])
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 87, in value
return what.toxml()
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 113, in toxml
manys = sum([[(m[0], v) for v in m[1]] for m in entries(Many)], [])
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 108, in <lambda>
entries = lambda clazz: [(name, rule.value(name, getattr(self, name))) for (name, rule) in items if isinstance(rule, clazz) and rule.check(getattr(self, name))]
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 99, in value
return el(*[self.rule.value(name, x) for x in what])
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 87, in value
return what.toxml()
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 111, in toxml
attributes = entries(Attribute)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 108, in <lambda>
entries = lambda clazz: [(name, rule.value(name, getattr(self, name))) for (name, rule) in items if isinstance(rule, clazz) and rule.check(getattr(self, name))]
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/allure/rules.py", line 82, in value
return str(what)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7: ordinal not in range(128)
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/__init__.py", line 872, in emit
stream.write(fs % msg)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/capture.py", line 234, in write
self.buffer.write(obj)
ValueError: I/O operation on closed file
Logged from file ssh.py, line 95
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/__init__.py", line 872, in emit
stream.write(fs % msg)
File "/home/aohontsev/autotest-framework/local/lib/python2.7/site-packages/_pytest/capture.py", line 234, in write
self.buffer.write(obj)
ValueError: I/O operation on closed file
Logged from file database.py, line 87
Process finished with exit code 1
There's no issue method like the other: step, attach, label, feature etc
Очень была бы полезной функция сортировки списка тестов (блок xUnit) в порядке их запуска.
Таким образом было бы проще находить тесты, оказывающие влияние на другие.
==================================== ERRORS ====================================
____________ ERROR collecting test.py _____________
test.py:14: in <module>
@pytest.allure.testcase('http://my.tms.org/TESTCASE-1')
env/lib/python3.4/site-packages/allure/pytest_plugin.py:356: in testcase
return self.label(Label.TESTCASE, *testcases)
env/lib/python3.4/site-packages/allure/pytest_plugin.py:317: in label
allure_label = getattr(pytest.mark, '%s.%s' % (Label.DEFAULT, name))
env/lib/python3.4/site-packages/_pytest/mark.py:184: in __getattr__
self._check(name)
env/lib/python3.4/site-packages/_pytest/mark.py:199: in _check
raise AttributeError("%r not a registered marker" % (name,))
E AttributeError: 'allure_label.testId' not a registered marker
=========================== 1 error in 0.06 seconds ============================
Hello! I had the error while trying to wrap method by decorator
@pytest.allure.testcase('http://my.tms.org/TESTCASE-1')
My configuration is : venv with python 3.4.3 installed, latest version of the pytest and allure. Ubuntu 14.04. Requirements installed:
apipkg==1.4
enum34==1.1.2
execnet==1.4.1
lxml==3.5.0
namedlist==1.7
Pillow==3.1.1
psutil==4.0.0
py==1.4.31
pytest==2.8.7
pytest-allure-adaptor==1.7.1
pytest-variables==1.3
pytest-xdist==1.14
pytractor==0.2.1
requests==2.9.1
selenium==2.52.0
six==1.10.0
TestLink-API-Python-client==0.6.2
wheel==0.29.0
Code:
@pytest.allure.testcase('http://my.tms.org/TESTCASE-1')
class SomeSanitySuite:
""" Sanity """
@pytest.mark.skipif(False, reason="No condition for ignoring yet")
def case(self, url, engine):
with step("Lets go to the main page"):
engine.get(url)
#time.sleep(2)
with step("Auth"):
HomePage.click_login()
if AuthHomePage.page_error():
engine.screenshot("login failed")
raise AssertionError("login failed")
AuthHomePage.Login(Vars.email, Vars.pass).by_email()
I have written a script that will attach the video after every test. The Video is getting attached in Windows, it is not attaching in Ubuntu.
Ubuntu server.
I am attaching it as a byte array.
@attachment(value = "Video of {0}",type="video/webm")
public byte[] attachVideo(String testCaseName,String path) throws Exception {
return getFile(path);
}
public byte[] getFile(String path) throws Exception {
return Files.readAllBytes(Paths.get(path));
}
Allure testng adaptor : 1.5.2
I am using testng as my unit testing framework. I am overriding the run method and I am attaching.
Again, works fine in Windows.
Let me know if there is an issue, or do I have to change anything else for Ubuntu server.
Regards,
Hemanth Sridhar
After pytest upgrade from 2.9.0 to 2.9.1 pytest-allure-adaptor seems to be broken:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 320, in _importconftest
mod = conftestpath.pyimport()
File "/usr/local/lib/python2.7/dist-packages/py/_path/local.py", line 650, in pyimport
__import__(modname)
File "some_test_directory/conftest.py", line 4, in <module>
import allure
File "/usr/local/lib/python2.7/dist-packages/allure/__init__.py", line 1, in <module>
from allure.pytest_plugin import MASTER_HELPER
File "/usr/local/lib/python2.7/dist-packages/allure/pytest_plugin.py", line 7, in <module>
from _pytest.junitxml import mangle_testnames
ImportError: cannot import name mangle_testnames
pytest-allure-adaptor version: 1.7.1
pytest version: 2.9.1
Please consider moving to new pytest-dev team. See contributing for more information.
Cheers,
For now there is no way to add default parameter value to step name:
import allure
@allure.step('some operation for bar={bar}')
def do_operation(bar="foo"):
# do stuff
def test_foo():
assert do_operation()
I have base mixin class for testing unique id inside the document
class UniqueIDTestCaseMixin(object):
"""
test unique id mixin
"""
@allure.story("check unique id")
@allure.severity(Severity.BLOCKER)
def test_unique_id(self):
# some checks are below
I apply this mixin agains base TestCases classes:
@allure.feature("Actions.xml")
class ActionsTest(UniqueIDTestCaseMixin, TestCase):
pass
@allure.feature("BankItems.xml")
class TestBankItems(UniqueIDTestCaseMixin, TestCase)):
pass
Here i get in xml files
<ns0:test-suite xmlns:ns0="urn:model.allure.qatools.yandex.ru" start="1412943507547" stop="1412943507658">
<name>tests.bank_items</name>
<test-cases>
<test-case start="1412943507547" status="passed" stop="1412943507569">
<name>TestBankItems.test_count</name>
<description> count field should be positive </description>
<attachments>
<attachment source="e5b219b9-7440-4f65-b298-45f7b5cd2a40-attachment.txt" title="Captured stderr setup" type="text/plain"/>
</attachments>
<labels>
<label name="story" value="items count"/>
<label name="severity" value="trivial"/>
<label name="feature" value="BankItems.xml"/>
</labels>
<steps/>
</test-case>
<test-case start="1412943507569" status="passed" stop="1412943507593">
<name>TestBankItems.test_size_color_fields</name>
<attachments>
<attachment source="84cfc3d3-5163-4f13-ade3-2ffd3076681b-attachment.txt" title="Captured stderr setup" type="text/plain"/>
</attachments>
<labels>
<label name="story" value="check color layers size (0->255)"/>
<label name="severity" value="blocker"/>
<label name="feature" value="BankItems.xml"/>
</labels>
<steps/>
</test-case>
<test-case start="1412943507593" status="passed" stop="1412943507618">
<name>TestBankItems.test_type_color_fields</name>
<description>
test sane color fields
</description>
<attachments>
<attachment source="478bf7eb-5caf-48ca-ad0b-c2aabdb2bdf7-attachment.txt" title="Captured stderr setup" type="text/plain"/>
</attachments>
<labels>
<label name="story" value="check color fields"/>
<label name="severity" value="blocker"/>
<label name="feature" value="BankItems.xml"/>
</labels>
<steps/>
</test-case>
<test-case start="1412943507618" status="passed" stop="1412943507640">
<name>TestBankItems.test_unique_id</name>
<attachments>
<attachment source="0bad8c6b-4b66-4dd6-93a1-d6c136dcda9a-attachment.txt" title="Captured stderr setup" type="text/plain"/>
</attachments>
<labels>
<label name="story" value="check unique id"/>
<label name="severity" value="blocker"/>
<label name="feature" value="Actions.xml"/>
<label name="feature" value="BankItems.xml"/>
</labels>
<steps/>
</test-case>
<test-case start="1412943507640" status="passed" stop="1412943507658">
<name>TestBankItems.test_unique_together</name>
<attachments>
<attachment source="3245235a-de3f-4fb1-85ae-65a29ca098b8-attachment.txt" title="Captured stderr setup" type="text/plain"/>
</attachments>
<labels>
<label name="story" value="check unique together id (if exists)"/>
<label name="severity" value="blocker"/>
<label name="feature" value="Actions.xml"/>
<label name="feature" value="BankItems.xml"/>
</labels>
<steps/>
</test-case>
</test-cases>
<labels/>
</ns0:test-suite>
i can even exclude anything regarding allure from my test (just have allure allure-adapter https://pypi.python.org/pypi/pytest-allure-adaptor installed).
import pytest
from selenium import webdriver
from multiprocessing.dummy import Pool as ThreadPool
urls = [...]
@pytest.mark.parametrize("url", urls)
def test_noindex(url):
assert url is not None
py.test -n [anything there] test_it.py will give following error:
============================= test session starts =============================
platform win32 -- Python 2.7.8 -- py-1.4.24 -- pytest-2.6.2
plugins: allure-adaptor, xdist
gw0 C / gw1 IINTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "C:\Python27\lib\site-packages\_pytest\main.py", line 82,
in wrap_session
INTERNALERROR> config.hook.pytest_sessionstart(session=session)
INTERNALERROR> File "C:\Python27\lib\site-packages\_pytest\core.py", line 413,
in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "C:\Python27\lib\site-packages\_pytest\core.py", line 424,
in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "C:\Python27\lib\site-packages\_pytest\core.py", line 315,
in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "C:\Python27\lib\site-packages\xdist\dsession.py", line 48
0, in pytest_sessionstart
INTERNALERROR> nodes = self.nodemanager.setup_nodes(putevent=self.queue.put)
INTERNALERROR> File "C:\Python27\lib\site-packages\xdist\slavemanage.py", line
45, in setup_nodes
INTERNALERROR> nodes.append(self.setup_node(spec, putevent))
INTERNALERROR> File "C:\Python27\lib\site-packages\xdist\slavemanage.py", line
54, in setup_node
INTERNALERROR> node.setup()
INTERNALERROR> File "C:\Python27\lib\site-packages\xdist\slavemanage.py", line
223, in setup
INTERNALERROR> self.channel.send((self.slaveinput, args, option_dict))
INTERNALERROR> File "C:\Python27\lib\site-packages\execnet\gateway_base.py", l
ine 681, in send
INTERNALERROR> self.gateway._send(Message.CHANNEL_DATA, self.id, dumps_inter
nal(item))
INTERNALERROR> File "C:\Python27\lib\site-packages\execnet\gateway_base.py", l
ine 1285, in dumps_internal
INTERNALERROR> return _Serializer().save(obj)
INTERNALERROR> File "C:\Python27\lib\site-packages\execnet\gateway_base.py", l
ine 1303, in save
INTERNALERROR> self._save(obj)
INTERNALERROR> File "C:\Python27\lib\site-packages\execnet\gateway_base.py", l
ine 1321, in _save
INTERNALERROR> dispatch(self, obj)
INTERNALERROR> File "C:\Python27\lib\site-packages\execnet\gateway_base.py", l
ine 1402, in save_tuple
INTERNALERROR> self._save(item)
INTERNALERROR> File "C:\Python27\lib\site-packages\execnet\gateway_base.py", l
ine 1321, in _save
INTERNALERROR> dispatch(self, obj)
INTERNALERROR> File "C:\Python27\lib\site-packages\execnet\gateway_base.py", l
ine 1398, in save_dict
INTERNALERROR> self._write_setitem(key, value)
INTERNALERROR> File "C:\Python27\lib\site-packages\execnet\gateway_base.py", l
ine 1392, in _write_setitem
INTERNALERROR> self._save(value)
INTERNALERROR> File "C:\Python27\lib\site-packages\execnet\gateway_base.py", l
ine 1319, in _save
INTERNALERROR> raise DumpError("can't serialize %s" % (tp,))
INTERNALERROR> DumpError: can't serialize <class 'allure.utils.LabelsList'>
Trying pip install pytest-allure-adaptor
with Python 2.7.10 I have got the following error:
...
creating build/temp.linux-x86_64-2.7/src/lxmlx86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/libxml2 -Isrc/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
In file included from src/lxml/lxml.etree.c:85:0:
/usr/include/python2.7/Python.h:8:22: fatal error: pyconfig.h: No such file or directory
compilation terminated.
Compile failed: command 'x86_64-linux-gnu-gcc' failed with exit status 1
...
main (int argc, char **argv) {
^
cc tmp/xmlXPathInitr_ehk5.o -lxml2 -o a.out
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1Cleaning up...
Command /media/win_d/Dropbox/Andriy_Work/PROJECTS/infinity/env/bin/python2 -c "import setuptools, tokenize;file='/tmp/pip-build-F3xYRb/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-PW72d1-record/install-record.txt --single-version-externally-managed --compile --install-headers /media/win_d/Dropbox/Andriy_Work/PROJECTS/infinity/env/include/site/python2.7 failed with error code 1 in /tmp/pip-build-F3xYRb/lxml
I should say that I have successfully installed pytest-allure-adaptor
on environment with Python3. Any ideas how to solve it with Python2.7?
Is it possible to get --alluredir param value inside test?
Hi,
Is it possible to attach .mp4 video to allure?
Trying this way, but it doesn't work?
allure.attach('Video attach', open("path to video").read())
Any ideas?
I set item name in conftest.py:
def pytest_runtest_setup(item):
item.name = '%custom_name%'
print item.name # changed
but in xml it stays with old names:
test_name[data0]
test_name[data1]
Can i somehow rename testcase name?
Замечательный незаменимый плагин, который параллелит тесты, отказывается работать вместе с --alluredir [path_to_dir]. Эксепшн валится после завершения первого теста
platform linux2 -- Python 2.7.3 -- py-1.4.20 -- pytest-2.5.2
plugins: allure-adaptor, rerunfailures, xdist, timeout
gw0 [4] / gw1 [4] / gw2 [4] / gw3 [4]
scheduling tests via LoadScheduling
.INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/_pytest/main.py", line 81, in wrap_session
INTERNALERROR> doit(config, session)
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/_pytest/main.py", line 118, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/_pytest/core.py", line 377, in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/_pytest/core.py", line 388, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/_pytest/core.py", line 289, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/xdist/dsession.py", line 242, in pytest_runtestloop
INTERNALERROR> self.loop_once()
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/xdist/dsession.py", line 260, in loop_once
INTERNALERROR> call(**kwargs)
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/xdist/dsession.py", line 325, in slave_testreport
INTERNALERROR> self.config.hook.pytest_runtest_logreport(report=rep)
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/_pytest/core.py", line 377, in __call__
INTERNALERROR> return self._docall(methods, kwargs)
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/_pytest/core.py", line 388, in _docall
INTERNALERROR> res = mc.execute()
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/_pytest/core.py", line 289, in execute
INTERNALERROR> res = method(**kwargs)
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/pytest_allure_adaptor-1.3.1-py2.7.egg/allure/pytest_plugin.py", line 231, in pytest_runtest_logreport
INTERNALERROR> self._stop_case(report, status=Status.PASSED)
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/pytest_allure_adaptor-1.3.1-py2.7.egg/allure/pytest_plugin.py", line 206, in _stop_case
INTERNALERROR> self.impl.stop_case(status)
INTERNALERROR> File "/usr/local/lib/python2.7/dist-packages/pytest_allure_adaptor-1.3.1-py2.7.egg/allure/common.py", line 115, in stop_case
INTERNALERROR> test = self.stack[-1]
INTERNALERROR> IndexError: list index out of range
When I run autotests with pytest+Selenium WebDriver+allure - allure makes screenshots,
but I run autotests with pyTest_uiAutomator+allure on mobile device Android - I get error when want to look png.file with screenshots.
My testcode:
@allure.feature('Autorization to ...')
@allure.story('Autorization to ...')
def test_autorization(self):
...
time.sleep(4)
d.press.home()
...
#Make photo of start page
allure.attach('my attach','Screen_start_page', allure.attach_type.PNG)
after that a have during open png file::
"Fatal error reading PNG image file: Not a PNG file"
test_attaches_with_capture_exist
test in test_smoke.py
have two failes.
Env:
pytest: 2.6.0
If tests produce lots of attachments py.test
memory footprint grows significantly with every attachment and is not reduced at any moment before test session finish.
This looks like a trouble with _allure_result
-passed data not being garbage-collected. Same tests run without --alluredir
do not use that much memory.
Also, memory usage is low for pytest-allure-adaptor < 1.7.0
-- looks like the problem was introduced in #80
Hi!
It's not an issue :)
I added Python 3 support to python3 branch in my personal repo. Code in python3 branch is incompatible with Python 2.x.
Would you like to add Python 3 branch to source repo for pull request?
In Jenkins matrix-job on reports collection step I've got this:
Allure Report Generation: started
Allure Report Generation: copy matrix builds results in directory [/jenkins/workspace/awaps-functional-test-matrix/allure93416645115399836.tmp/results]
FATAL: java.io.IOException: Failed to extract /jenkins/compound-root/workspace/awaps-functional-test-matrix/LABEL/awaps-basic-openstack/TESTPACK/P1/reports/*/
at hudson.FilePath.readFromTar(FilePath.java:2088)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2000)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1911)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1894)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1879)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher$1.endBuild(AllureReportPublisher.java:168)
at org.jenkins_ci.plugins.flexible_publish.ConditionalMatrixAggregator.endBuild(ConditionalMatrixAggregator.java:78)
at org.jenkins_ci.plugins.flexible_publish.FlexibleMatrixAggregator.endBuild(FlexibleMatrixAggregator.java:100)
at hudson.matrix.MatrixBuild$MatrixBuildExecution.post2(MatrixBuild.java:403)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:725)
at hudson.model.Run.execute(Run.java:1695)
at hudson.matrix.MatrixBuild.run(MatrixBuild.java:304)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
at hudson.model.OneOffExecutor.run(OneOffExecutor.java:43)
Caused by: java.io.FileNotFoundException: /jenkins/workspace/awaps-functional-test-matrix/allure93416645115399836.tmp/results/000fad39-1984-4dfb-a05a-ab71328cdcca-attachment.txt (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:221)
at java.io.FileOutputStream.(FileOutputStream.java:171)
at hudson.util.IOUtils.copy(IOUtils.java:35)
at hudson.FilePath.readFromTar(FilePath.java:2078)
... 14 more
java.io.IOException: java.io.IOException: Failed to extract /jenkins/compound-root/workspace/awaps-functional-test-matrix/LABEL/awaps-basic-openstack/TESTPACK/P1/reports/*/
at hudson.FilePath.readFromTar(FilePath.java:2088)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2000)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1911)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1894)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1879)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher$1.endBuild(AllureReportPublisher.java:168)
at org.jenkins_ci.plugins.flexible_publish.ConditionalMatrixAggregator.endBuild(ConditionalMatrixAggregator.java:78)
at org.jenkins_ci.plugins.flexible_publish.FlexibleMatrixAggregator.endBuild(FlexibleMatrixAggregator.java:100)
at hudson.matrix.MatrixBuild$MatrixBuildExecution.post2(MatrixBuild.java:403)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:725)
at hudson.model.Run.execute(Run.java:1695)
at hudson.matrix.MatrixBuild.run(MatrixBuild.java:304)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
at hudson.model.OneOffExecutor.run(OneOffExecutor.java:43)
Caused by: java.io.FileNotFoundException: /jenkins/workspace/awaps-functional-test-matrix/allure93416645115399836.tmp/results/000fad39-1984-4dfb-a05a-ab71328cdcca-attachment.txt (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:221)
at java.io.FileOutputStream.(FileOutputStream.java:171)
at hudson.util.IOUtils.copy(IOUtils.java:35)
at hudson.FilePath.readFromTar(FilePath.java:2078)
... 14 more
at hudson.FilePath.copyRecursiveTo(FilePath.java:2007)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1911)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1894)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1879)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher$1.endBuild(AllureReportPublisher.java:168)
at org.jenkins_ci.plugins.flexible_publish.ConditionalMatrixAggregator.endBuild(ConditionalMatrixAggregator.java:78)
at org.jenkins_ci.plugins.flexible_publish.FlexibleMatrixAggregator.endBuild(FlexibleMatrixAggregator.java:100)
at hudson.matrix.MatrixBuild$MatrixBuildExecution.post2(MatrixBuild.java:403)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:725)
at hudson.model.Run.execute(Run.java:1695)
at hudson.matrix.MatrixBuild.run(MatrixBuild.java:304)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
at hudson.model.OneOffExecutor.run(OneOffExecutor.java:43)
Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Pipe is already closed
at hudson.remoting.Channel$3.adapt(Channel.java:755)
at hudson.remoting.Channel$3.adapt(Channel.java:750)
at hudson.remoting.FutureAdapter.get(FutureAdapter.java:59)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2003)
... 13 more
Caused by: java.io.IOException: Pipe is already closed
at hudson.remoting.PipeWindow.checkDeath(PipeWindow.java:108)
at hudson.remoting.PipeWindow$Real.get(PipeWindow.java:203)
at hudson.remoting.ProxyOutputStream._write(ProxyOutputStream.java:135)
at hudson.remoting.ProxyOutputStream.write(ProxyOutputStream.java:103)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)
at com.jcraft.jzlib.DeflaterOutputStream.deflate(DeflaterOutputStream.java:144)
at com.jcraft.jzlib.DeflaterOutputStream.write(DeflaterOutputStream.java:102)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
at org.apache.tools.tar.TarBuffer.writeBlock(TarBuffer.java:410)
at org.apache.tools.tar.TarBuffer.writeRecord(TarBuffer.java:351)
at hudson.org.apache.tools.tar.TarOutputStream.writeEOFRecord(TarOutputStream.java:356)
at hudson.org.apache.tools.tar.TarOutputStream.finish(TarOutputStream.java:137)
at hudson.org.apache.tools.tar.TarOutputStream.close(TarOutputStream.java:149)
at hudson.util.io.TarArchiver.close(TarArchiver.java:125)
at hudson.FilePath.writeToTar(FilePath.java:2054)
at hudson.FilePath.access$1000(FilePath.java:172)
at hudson.FilePath$41.invoke(FilePath.java:1993)
at hudson.FilePath$41.invoke(FilePath.java:1989)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2461)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.IOException: Pipe is already closed
at hudson.remoting.FastPipedOutputStream.write(FastPipedOutputStream.java:147)
at hudson.remoting.FastPipedOutputStream.write(FastPipedOutputStream.java:131)
at hudson.remoting.ProxyOutputStream$Chunk$1.run(ProxyOutputStream.java:250)
at hudson.remoting.PipeWriter$1.run(PipeWriter.java:158)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:111)
... 5 more
Caused by: hudson.remoting.FastPipedInputStream$ClosedBy: The pipe was closed at...
at hudson.remoting.FastPipedInputStream.close(FastPipedInputStream.java:112)
at java.io.FilterInputStream.close(FilterInputStream.java:181)
at com.jcraft.jzlib.InflaterInputStream.close(InflaterInputStream.java:168)
at org.apache.tools.tar.TarBuffer.close(TarBuffer.java:456)
at hudson.org.apache.tools.tar.TarInputStream.close(TarInputStream.java:110)
at hudson.FilePath.readFromTar(FilePath.java:2095)
at hudson.FilePath.copyRecursiveTo(FilePath.java:2000)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1911)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1894)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1879)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher$1.endBuild(AllureReportPublisher.java:168)
at org.jenkins_ci.plugins.flexible_publish.ConditionalMatrixAggregator.endBuild(ConditionalMatrixAggregator.java:78)
at org.jenkins_ci.plugins.flexible_publish.FlexibleMatrixAggregator.endBuild(FlexibleMatrixAggregator.java:100)
at hudson.matrix.MatrixBuild$MatrixBuildExecution.post2(MatrixBuild.java:403)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:725)
at hudson.model.Run.execute(Run.java:1695)
at hudson.matrix.MatrixBuild.run(MatrixBuild.java:304)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
at hudson.model.OneOffExecutor.run(OneOffExecutor.java:43)
After all, @mavlyutov thinks this issue may be related to https://issues.jenkins-ci.org/browse/JENKINS-9540 somehow.
В модели есть name, а есть title.
Name - генерируется адаптером в формате {name.space}.{testName}[{params}]
{name.space}
- какой-то неймспейс, например, в джаве это package+className, без пробельных символов{test-name}
- имя теста, может быть в camelCase, small-case, не содержит точек{params}
- некоторая строка, не содержащая терминальных символовName не может задаваться пользователем.
Title - human-readable имя. Задается пользователем. Если title пуст, то он генерируется автоматически из name
В отчете отображается title
Используемая версия - 1.3.9
Если пометить тест как skipped средствами py.test ( декоратор pytest.mark.skipif ) allure генерирует отчет, но в Suite не будет списка проваленных тестов.
В консоль firefox пишется вот такая ошибка:
"Error: testcase.status is null
$scope.statistic<@http://localhost:54555/js/testcase/list.js:62:13
@http://localhost:54555/js/testcase/list.js:61:28
$RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:54555/vendor/angular/angular.js:11789:23
$RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:54555/vendor/angular/angular.js:12042:13
done@http://localhost:54555/vendor/angular/angular.js:7824:34
completeRequest@http://localhost:54555/vendor/angular/angular.js:8007:7
createHttpBackend/</xhr.onreadystatechange@http://localhost:54555/vendor/angular/angular.js:7963:1
" angular.js:9400:17
Думается, можно привязаться к существующему декоратору py.test'а @pytest.mark.mark_name
для расширения выводимой в репорте информации
How can i mark my test as broken?
See this section for details.
при запуске py.test -x
на последний зафейленный тест не генерится xml
def test_first():
allure.issue('FOO-111')
pytest.xfail('FOO-111')
assert 0
or
def pytest_runtest_setup(item):
allure.issue('BAR-222')
item.add_marker(pytest.mark.xfail('BAR-222'))
def test_second():
assert 0
Would be nice to support nose too.
Any plans or suggestions what can be reused from this repo?
INTERNALERROR> File "/python3.4/site-packages/pytest_allure_adaptor-1.7.6-py3.4.egg/allure/pytest_plugin.py", line 546, in pytest_runtest_logreport
INTERNALERROR> File "/python3.4/site-packages/pytest_allure_adaptor-1.7.6-py3.4.egg/allure/pytest_plugin.py", line 534, in write_attach
INTERNALERROR> File "python3.4/site-packages/pytest_allure_adaptor-1.7.6-py3.4.egg/allure/common.py", line 209, in _save_attach
INTERNALERROR> File "/python3.4/contextlib.py", line 59, in enter
INTERNALERROR> File "lib/python3.4/site-packages/pytest_allure_adaptor-1.7.6-py3.4.egg/allure/common.py", line 223, in _attachfile
NTERNALERROR> OSError: [Errno 24] Too many open files: '/archive/test_20170419-171434/allure/8455948b-6351-4333-b2f9-dc5462e3d0b5-attachment.txt'
У меня есть набор тестов которые работают примерно таким образом
if __name__ == '__main__':
pytest.main('testcases/tests/')
Есть ли на данный момент возможность генерировать xml файлы напрямую из кода, а не зпускать каждый раз в консоли py.test --alluredir=path tests.py
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.