Comments (10)
the most simple way to run one py.test run with a custom plugin is
import pytest
import myplugin
pytest.main(['args'], plugins=[myplugin])
from betelgeuse.
Can you elaborate a little bit more why passing a path would not help? Is that related to how a method or function is identified as being a test?
from betelgeuse.
py.test tests are identified by a node id consisting of file-name, a object path, and a parameter set
from betelgeuse.
@RonnyPfannschmidt can you provide a sample file with a sample py.test call please?
I use py.test for capturing Python unittest tests and since I am not too familiar with tests written using the py.test way that will help clarify what is really needed.
from betelgeuse.
import pytest
@pytest.fixture(params=[1, 2], scope='module')
def foo(request):
return request.param
@pytest.fixture(params='abc')
def bar(request):
return request.param
def test_a(foo, bar):
pass
def test_b(foo, bar):
pass
results in
$ py.test -v
=============================================================================================== test session starts ===============================================================================================
platform linux2 -- Python 2.7.11 -- py-1.4.31 -- pytest-2.7.3 -- /nix/store/34sscviv2lpz6vr308gg99rdc2hbhlis-python-2.7.11/bin/python2.7
rootdir: /home/ronny/Projects/example, inifile:
collected 12 items
test_fun.py::test_a[1-a] PASSED
test_fun.py::test_a[1-b] PASSED
test_fun.py::test_a[1-c] PASSED
test_fun.py::test_b[1-a] PASSED
test_fun.py::test_b[1-b] PASSED
test_fun.py::test_b[1-c] PASSED
test_fun.py::test_a[2-a] PASSED
test_fun.py::test_a[2-b] PASSED
test_fun.py::test_a[2-c] PASSED
test_fun.py::test_b[2-a] PASSED
test_fun.py::test_b[2-b] PASSED
test_fun.py::test_b[2-c] PASSED
============================================================================================ 12 passed in 0.01 seconds ============================================================================================
from betelgeuse.
@RonnyPfannschmidt thank you. That makes things more clear, I know that py.test can be called from another python script, need to check how to deal with test discovery.
What is your suggestion to do with the parameters? What should be done on Polarion? Should it create a different test case using the same docstring for all permutations?
from betelgeuse.
i am not yet sure what to do with parameters and their mapping to polarion
py.test can be invoked from a process, and it can also be handed a plugin to catch the reports
from betelgeuse.
@RonnyPfannschmidt thanks for all the clarification. If you have any examples about calling py.test from a process that will help, even better if you want to contribute the code yourself.
from betelgeuse.
Having another round checking this issue I realized that Betelgeuse is able to import py.test tests so it will create one test for each test function.
When creating the test run Polarion allows the definition of a parameter. That said Betelgeuse should read the parametrized jUnit report generated by py.test and properly create the test run or the XML to be imported by the xUnit test run importer.
I will update this issue to be making Betelgeuse properly import parametrized tests on test runs.
from betelgeuse.
This issue will be handled by #123
from betelgeuse.
Related Issues (20)
- upstream token is not valid across different project, make it editable only when present HOT 1
- Provide RST parsing errors and warnings
- We should be able to pass some tokens (Requirement,CaseLevel, CaseImportance, TestType, etc.) through command line HOT 2
- Please add Requirement and Automation Script fields to be used by Betelgeuse Configuration Module HOT 1
- Make use of <testcase status-id="approved"> to update Test Case status HOT 1
- Provide help message for the --config-module option
- Document a list of custom fields and its values - IDs in Polarion HOT 2
- allow '.' as test path
- Allow sending files to Polarion HOT 4
- Request to parse multiple lines for fields like "title" in docstrings HOT 2
- Make Betelgeuse Python 3.6+ only HOT 7
- Update the betelgeuse requirement command to generate the XML for the Requirement Importer
- Pytest style parametrization HOT 6
- test case id not derived by test-run
- [test-case] Higher-level metadata might be used when keys use inconsistent casing
- pylarion now supporting python 3 HOT 2
- Traceback when running betelgeuse for insights tests HOT 2
- "betelgeuse test-run --status inprogress" isnt updating the test-run correctly HOT 3
- AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren' with Python 3.9 HOT 2
- Move to Github Actions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from betelgeuse.