Skip to content

Commit

Permalink
Add a force option to the configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
mblayman committed Sep 13, 2015
1 parent bd4d2e7 commit 83873c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions handroll/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def load_from_arguments(self, args):
"""Load any configuration attributes from the provided command line
arguments. Arguments have the highest precedent so overwrite any other
value if a value exists."""
if args.force:
self.force = True

if args.outdir is not None:
self.outdir = os.path.abspath(args.outdir)

Expand Down
10 changes: 10 additions & 0 deletions handroll/tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
class FakeArgs(object):

def __init__(self):
self.force = False
self.outdir = None
self.timing = None

Expand All @@ -28,6 +29,15 @@ def test_loads_from_outdir_argument(self):
expected = os.path.join(os.getcwd(), args.outdir)
self.assertEqual(expected, config.outdir)

def test_loads_from_force_argument(self):
config = configuration.Configuration()
args = FakeArgs()
args.force = True

config.load_from_arguments(args)

self.assertTrue(config.force)

def test_build_config_from_file(self):
conf_file = inspect.cleandoc(
"""[site]
Expand Down

0 comments on commit 83873c0

Please sign in to comment.