Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8567163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:49:10+00:00 2026-06-11T17:49:10+00:00

So I have the following structure: class Test(object): def test_1(self): pass def test_2(self): pass

  • 0

So I have the following structure:

class Test(object):

   def test_1(self):
      pass

   def test_2(self):
      pass

   def test_3(self):
      pass

it runs great, NOW I’m adding the “scenarios” (as it’s recommended at pytest – A quick port of “testscenarios”):

def pytest_generate_tests(metafunc):
    idlist = []
    argvalues = []
    for scenario in metafunc.cls.scenarios:
        idlist.append(scenario[0])
        items = scenario[1].items()
        argnames = [x[0] for x in items]
        argvalues.append(([x[1] for x in items]))
    metafunc.parametrize(argnames, argvalues, ids=idlist)

class Test(object):
       scenarios = ['1' {'arg':'value1'},
                    '2' {'arg':'value2'}]

       def test_1(self, arg):
          pass

       def test_2(self, arg):
          pass

       def test_3(self, arg):
          pass

When I run it the ORDER of tests is wrong, I get:

test_1[1]  
test_1[2]  
test_2[1]   
test_2[2]  
test_3[1]  
test_3[2]

Doesn’t really look like a scenario for the Test class.

QUESTION: Is the any solution to run it in the correct order? like:

test_1[1]
test_2[1]
test_3[1]
test_1[2]
test_2[2]
test_3[2]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:49:11+00:00Added an answer on June 11, 2026 at 5:49 pm

    The upcoming pytest-2.3 has support for better (resource-based) ordering, and i just updated the scenario example in the docs: https://docs.pytest.org/en/latest/example/parametrize.html#a-quick-port-of-testscenarios

    You can preliminary install the current development version with

    pip install -i http://pypi.testrun.org -U pytest
    

    and should get pytest-2.3.0.dev15 with “py.test –version” and be able to use it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following structure: class foo(object): class bar(object): def __init__(self, parent): self._parent=parent #this
I have the following model structure: class Container(models.Model): pass class Generic(models.Model): name = models.CharacterField(unique=True)
I'm using ASP.NET MVC2 and I have the following object structure: public class IDealer
I have the following directory structure. src| |pack| |Test.java data| |data.txt classes| |pack| |Test.class
I have a class like the following: class A: def __init__(self, arg1, arg2, arg3):
I have the following class structure that I need to unit test: public interface
I have the following structure: class User include Mongoid::Document end class Resource include Mongoid::Document
I have the following class structure: class Organization { string Name; List<User> users; List<Organization>
I have the following class structure class Top : NotifyPropertyChanged { private List<Inner> innerList;
I have the following model structure: class Group < ActiveRecord::Base has_many :group_products, :dependent =>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.