平台linux——Python 3.6.7、pytest-4.4.0、py-1.8.0、pluggy-0.9.0
#example.py
try:
import configparser
except ImportError:
import ConfigParser as configparser
CONFIG = configparser.ConfigParser()
CONFIG.read(sys.argv[1])
ININFO = {i:dict(CONFIG.items(i)) for i in CONFIG.sections()}
DATANAME = ININFO['data']['name']
def somefunction(DATANAME):
"""
This function will take lot of variables from ini file
"""
print(DATANAME)
s1 = "Pass"
s2 = "Fail"
s3 = "Pass"
print(s1, s2, s3)
return [s1, s2, s3]
def test_somefunction():
"""
Test function
- Will check whether all steps are passed or not.
"""
status = somefunction()
for sts in status: …Run Code Online (Sandbox Code Playgroud)