diff --git a/tests/test_special_options.py b/tests/test_special_options.py new file mode 100644 index 0000000000000000000000000000000000000000..32c466ece24af7fa6134ead2d56428e0044660a6 --- /dev/null +++ b/tests/test_special_options.py @@ -0,0 +1,22 @@ +def test_without_special_options(): + """ + The "special options" of "config", "dump", and "dumps" are useful but they + prevent the user from being able to use them as official config args. + """ + import scriptconfig as scfg + class MyConfig(scfg.DataConfig): + config = None + + # Without using the ``cli`` classmethod there should be no issue with using + # these "special options". + config = MyConfig() + assert config.config is None + + # But, if special options are enabled we cannot have options that conflict + import pytest + with pytest.raises(Exception): + config = MyConfig.cli(argv=['--config=foo'], special_options=True) + + # But setting special_options=False will allow for this + config = MyConfig.cli(argv=['--config=foo'], special_options=False) + assert config.config == 'foo'