Last active
August 29, 2015 14:15
-
-
Save poliarush/8f359113bf4fbe0a9be1 to your computer and use it in GitHub Desktop.
configparser issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[sites] | |
base_site = testsite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>python test_something.py | |
test_CheckoutPromoCode (__main__.CheckoutPromoTest) ... ok | |
---------------------------------------------------------------------- | |
Ran 1 test in 0.001s | |
OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ConfigParser | |
config = ConfigParser.RawConfigParser() | |
config.read('app.cfg') | |
base_site = config.get('sites', 'base_site') | |
def functions(): | |
return base_site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>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 =========================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>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 =========================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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