[TIP] global parameter?

James bjlockie at lockie.ca
Thu Oct 20 11:02:06 PDT 2016


Is there a way to make a variable/parameter global?

# conftest.py
import pytest

@pytest.fixture(scope='module')
def a(request):
     A = request.config.getoption("A")


import inspect
import pytest

# testscript.py

@pytest.mark.incremental
class TestAclass():
     def test_1(self):
         print 'inside {0}-{1} 
step'.format(self.__class__.__name__,inspect.currentframe().f_code.co_name)
         print A
         pass





More information about the testing-in-python mailing list