Skip to content

Instantly share code, notes, and snippets.

@poliarush
Last active August 29, 2015 14:15
Show Gist options
  • Save poliarush/8f359113bf4fbe0a9be1 to your computer and use it in GitHub Desktop.
Save poliarush/8f359113bf4fbe0a9be1 to your computer and use it in GitHub Desktop.
configparser issue
[sites]
base_site = testsite
>python test_something.py
test_CheckoutPromoCode (__main__.CheckoutPromoTest) ... ok
----------------------------------------------------------------------
Ran 1 test in 0.001s
OK
import ConfigParser
config = ConfigParser.RawConfigParser()
config.read('app.cfg')
base_site = config.get('sites', 'base_site')
def functions():
return base_site
>py.test -v -s .
============================= test session starts =============================
platform win32 -- Python 2.7.3 -- pytest-2.5.1 -- c:\Program Files (x86)\Python27\python.exe
plugins: xdist
collected 1 items
test_something.py:14: CheckoutPromoTest.test_CheckoutPromoCode PASSED
========================== 1 passed in 0.03 seconds ===========================
>py.test -v -s -n 2 .
============================= test session starts =============================
platform win32 -- Python 2.7.3 -- pytest-2.5.1 -- c:\Program Files (x86)\Python27\python.exe
plugins: xdist
[gw0] win32 Python 2.7.3 cwd: d:\temp\demo\config-parser
[gw1] win32 Python 2.7.3 cwd: d:\temp\demo\config-parser
[gw0] Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
[gw1] Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
gw0 [1] / gw1 [1]
scheduling tests via LoadScheduling
[gw1] PASSED test_something.py:14: CheckoutPromoTest.test_CheckoutPromoCode
========================== 1 passed in 0.47 seconds ===========================
from lib import functions
import unittest
class CheckoutPromoTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_CheckoutPromoCode(self):
assert functions() == 'testsite'
if __name__ == "__main__":
unittest.main(verbosity=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment