jeudi 23 mars 2017

pytest: Is test performance faster for tests in many small modules or wrapped under classes in a few large modules?

I have the option of grouping my tests into small modules with tests being functions in the module, or grouping several classes with the tests as methods in larger module files. I was wondering if there were any significant speed gains in test collection and execution one way or the other.

Grouped in modules:

# test_apple.py 
def test_apple_foo():
    pass

def test_apple_bar():
    pass

-

# test_orange.py
def test_orange_foo():
    pass

Grouped in classes:

# test_fruits.py
class TestApple():
    def test_apple_foo(self):
        pass

    def test_apple_bar(self):
        pass


class TestOrange():
    def test_orange_foo(self):
        pass

Aucun commentaire:

Enregistrer un commentaire