python - How can I access a value which is defined in a __init__ function, as a parameter to my test_case -


i have test case data, created in init function. need use parameter test case, unable access test_case_data

class something(object):      def __init__(self, logger):       #do       self.test_case_data = ... #got test case data      @pytest.mark.p0       @pytest.parameterize("paramter1, parameter2, .. , ..", test_case_data)      def test_something():        #do_something 

this code looks like. want use test_case_data parameter, defined in init function.

init isn't run until make instance of class. access:

class classname(object):     def __init__(self):         self.variable = "value"  instance = classname() print(instance.variable) 

i'm not sure you're trying here thing remember data members declared in init don't exist until make instance of class.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -