Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
castalheiro committed Mar 6, 2022
1 parent ae5c426 commit 1c01b5d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_doit_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,19 @@ def test_merge_api_toml_config(self):
assert main.config['foo'] == {'nval': 33}
assert main.config['task:bar'] == {'opt': "baz"}

def test_merge_api_toml_config_with_prefix(self):
config_filename = os.path.join(os.path.dirname(__file__), 'sample_with_prefix.toml')
main = doit_cmd.DoitMain(config_filenames=config_filename,
toml_config_files_prefix="tool.doit")
assert 1 == len(main.config['COMMAND'])
# test loaded plugin command is actually used with plugin name
assert 'foo' in main.get_cmds()
# INI has higher preference the api_config
assert main.config['GLOBAL'] == {'optx':'6', 'opty':'7'}

assert main.config['foo'] == {'nval': 33}
assert main.config['task:bar'] == {'opt': "baz"}


def test_find_pyproject_toml_config(self):
config_filename = os.path.join(os.path.dirname(__file__), 'pyproject.toml')
Expand Down

0 comments on commit 1c01b5d

Please sign in to comment.