Giter Site home page Giter Site logo

Comments (10)

RonnyPfannschmidt avatar RonnyPfannschmidt commented on September 26, 2024 1

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.

elyezer avatar elyezer commented on September 26, 2024

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.

RonnyPfannschmidt avatar RonnyPfannschmidt commented on September 26, 2024

py.test tests are identified by a node id consisting of file-name, a object path, and a parameter set

from betelgeuse.

elyezer avatar elyezer commented on September 26, 2024

@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.

RonnyPfannschmidt avatar RonnyPfannschmidt commented on September 26, 2024
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.

elyezer avatar elyezer commented on September 26, 2024

@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.

RonnyPfannschmidt avatar RonnyPfannschmidt commented on September 26, 2024

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.

elyezer avatar elyezer commented on September 26, 2024

@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.

elyezer avatar elyezer commented on September 26, 2024

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.

elyezer avatar elyezer commented on September 26, 2024

This issue will be handled by #123

from betelgeuse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.