Skip to content

Instantly share code, notes, and snippets.

@mcdonc
Created December 21, 2012 06:30
Show Gist options
  • Save mcdonc/4351050 to your computer and use it in GitHub Desktop.
Save mcdonc/4351050 to your computer and use it in GitHub Desktop.
def test_it_location_is_not_dir():
from somewhere import Config
c = Config()
c.os = DummyOS(False)
assertRaises(SomeException, setattr, c, settings_location, '/whatever')
def test_it_location_is_dir():
from somewhere import Config
c = Config()
c.os = DummyOS(True)
c.settings_location = 'foo'
assert c.settings_location == 'foo'
class DummyOS(object):
def __init__(self, result):
self.result = result
@property
def path(self):
return self
def isdir(self, location):
return self.result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment