@@ -60,26 +60,26 @@ def get_storage_name_for(cls, section_name):
60
60
# @pytest.fixture
61
61
# def runner2():
62
62
# return CliRunner()
63
-
64
- xfail = pytest .mark .xfail
65
-
63
+ #
66
64
# -----------------------------------------------------------------------------
67
65
# TEST SUITE
68
66
# -----------------------------------------------------------------------------
67
+ xfail = pytest .mark .xfail
68
+
69
69
class TestBasics (object ):
70
- def test_without_configfile__uses_defaults_from_cmdline (self , isolated_runner ):
70
+ def test_without_configfile__uses_defaults_from_cmdline (self , cli_runner ):
71
71
CONTEXT_SETTINGS = dict (default_map = ConfigFileProcessor1 .read_config ())
72
72
@click .command (context_settings = CONTEXT_SETTINGS )
73
73
@click .option ("-n" , "--name" , default = "__CMDLINE__" )
74
74
def hello (name ):
75
75
click .echo ("Hello %s" % name )
76
76
77
77
assert not os .path .exists ("hello.ini" )
78
- result = isolated_runner .invoke (hello )
78
+ result = cli_runner .invoke (hello )
79
79
assert result .exit_code == 0
80
80
assert result .output == "Hello __CMDLINE__\n "
81
81
82
- def test_with_cmdline_and_configfile__prefers_cmdline (self , isolated_runner ):
82
+ def test_with_cmdline_and_configfile__prefers_cmdline (self , cli_runner_isolated ):
83
83
assert ConfigFileProcessor1 .config_files [0 ] == "hello.ini"
84
84
CONFIG_FILE_CONTENTS1 = """
85
85
[hello]
@@ -95,11 +95,11 @@ def test_with_cmdline_and_configfile__prefers_cmdline(self, isolated_runner):
95
95
def hello (name ):
96
96
click .echo ("Hello %s" % name )
97
97
98
- result = isolated_runner .invoke (hello , ["--name" , "CMDLINE_VALUE" ])
98
+ result = cli_runner_isolated .invoke (hello , ["--name" , "CMDLINE_VALUE" ])
99
99
assert result .exit_code == 0
100
100
assert result .output == "Hello CMDLINE_VALUE\n "
101
101
102
- def test_with_configfile1__preferred_over_cmdline_defaults (self , isolated_runner ):
102
+ def test_with_configfile1__preferred_over_cmdline_defaults (self , cli_runner_isolated ):
103
103
assert ConfigFileProcessor1 .config_files [0 ] == "hello.ini"
104
104
CONFIG_FILE_CONTENTS1 = """
105
105
[hello]
@@ -116,11 +116,11 @@ def hello(name):
116
116
click .echo ("Hello %s" % name )
117
117
118
118
assert os .path .exists ("hello.ini" )
119
- result = isolated_runner .invoke (hello )
119
+ result = cli_runner_isolated .invoke (hello )
120
120
assert result .exit_code == 0
121
121
assert result .output == "Hello Alice\n "
122
122
123
- def test_with_configfile2__usable_as_alternative (self , isolated_runner ):
123
+ def test_with_configfile2__usable_as_alternative (self , cli_runner_isolated ):
124
124
assert ConfigFileProcessor1 .config_files [1 ] == "hello.cfg"
125
125
CONFIG_FILE_CONTENTS2 = """
126
126
[hello]
@@ -136,11 +136,11 @@ def test_with_configfile2__usable_as_alternative(self, isolated_runner):
136
136
def hello (name ):
137
137
click .echo ("Hello %s" % name )
138
138
139
- result = isolated_runner .invoke (hello )
139
+ result = cli_runner_isolated .invoke (hello )
140
140
assert result .exit_code == 0
141
141
assert result .output == "Hello Bob\n "
142
142
143
- def test_with_configfile12__prefers_configfile1 (self , isolated_runner ):
143
+ def test_with_configfile12__prefers_configfile1 (self , cli_runner_isolated ):
144
144
assert ConfigFileProcessor1 .config_files == ["hello.ini" , "hello.cfg" ]
145
145
CONFIG_FILE_CONTENTS1 = """
146
146
[hello]
@@ -161,12 +161,11 @@ def test_with_configfile12__prefers_configfile1(self, isolated_runner):
161
161
def hello (name ):
162
162
click .echo ("Hello %s" % name )
163
163
164
- result = isolated_runner .invoke (hello )
164
+ result = cli_runner_isolated .invoke (hello )
165
165
assert result .exit_code == 0
166
166
assert result .output == "Hello alice\n "
167
167
168
- # @xfail
169
- def test_configfile__can_pass_additional_params_in_context (self , isolated_runner ):
168
+ def test_configfile__can_pass_additional_params_in_context (self , cli_runner_isolated ):
170
169
assert ConfigFileProcessor1 .config_files [0 ] == "hello.ini"
171
170
assert not os .path .exists ("hello.cfg" )
172
171
CONFIG_FILE_CONTENTS = """
@@ -192,7 +191,7 @@ def hello(ctx, name):
192
191
click .echo ("bar.numbers: %s" % repr (ctx .default_map ["bar" ]["numbers" ]))
193
192
194
193
assert os .path .exists ("hello.ini" )
195
- result = isolated_runner .invoke (hello )
194
+ result = cli_runner_isolated .invoke (hello )
196
195
expected_output = """\
197
196
Hello Alice
198
197
foo.numbers: [1, 2, 3]
0 commit comments