9
9
10
10
PY_IMPL = platform .python_implementation ()
11
11
IS_PYPY = "pypy" in PY_IMPL .lower ()
12
+ IS_WIN = platform .system () == "Windows"
12
13
13
14
14
15
# TODO: others?
60
61
@mark .parametrize ("lite_args" , LITE_INVOCATIONS )
61
62
def test_cli_version (lite_args , script_runner ):
62
63
"""do various invocations work"""
63
- returned_version = script_runner .run (* lite_args , "--version" )
64
+ returned_version = script_runner .run ([ * lite_args , "--version" ] )
64
65
assert returned_version .success
65
66
assert __version__ in returned_version .stdout
66
67
assert returned_version .stderr == ""
@@ -70,21 +71,21 @@ def test_cli_version(lite_args, script_runner):
70
71
@mark .parametrize ("help" , ["-h" , "--help" ])
71
72
def test_cli_help (lite_args , help , script_runner ): # noqa: A002
72
73
"""does help work"""
73
- returned_version = script_runner .run (* lite_args , help )
74
+ returned_version = script_runner .run ([ * lite_args , help ] )
74
75
assert returned_version .success
75
76
assert returned_version .stderr == ""
76
77
77
78
78
79
@mark .parametrize ("lite_args" , LITE_INVOCATIONS )
79
80
def test_nonzero_rc (lite_args , script_runner ):
80
- a_step = script_runner .run (* lite_args , "doit" , "this-is-not-a-step" )
81
+ a_step = script_runner .run ([ * lite_args , "doit" , "this-is-not-a-step" ] )
81
82
assert not a_step .success
82
83
83
84
84
85
@mark .parametrize ("lite_hook" , ["list" , "status" ])
85
86
def test_cli_status_null (lite_hook , an_empty_lite_dir , script_runner ):
86
87
"""do the "side-effect-free" commands create exactly one file?"""
87
- returned_status = script_runner .run ("jupyter" , "lite" , lite_hook , cwd = str (an_empty_lite_dir ))
88
+ returned_status = script_runner .run ([ "jupyter" , "lite" , lite_hook ] , cwd = str (an_empty_lite_dir ))
88
89
assert returned_status .success
89
90
files = set (an_empty_lite_dir .rglob ("*" ))
90
91
# we would expect to see our build cruft sqlite
@@ -103,7 +104,7 @@ def test_cli_any_hook( # noqa: PLR0915
103
104
"""
104
105
expected_files = TRASH if lite_hook in FAST_HOOKS else A_GOOD_BUILD
105
106
started = time .time ()
106
- returned_status = script_runner .run ("jupyter" , "lite" , lite_hook , cwd = str (an_empty_lite_dir ))
107
+ returned_status = script_runner .run ([ "jupyter" , "lite" , lite_hook ] , cwd = str (an_empty_lite_dir ))
107
108
duration_1 = time .time () - started
108
109
assert returned_status .success
109
110
files = set (an_empty_lite_dir .rglob ("*" ))
@@ -116,11 +117,14 @@ def test_cli_any_hook( # noqa: PLR0915
116
117
117
118
# re-run, be faster
118
119
restarted = time .time ()
119
- rereturned_status = script_runner .run ("jupyter" , "lite" , lite_hook , cwd = str (an_empty_lite_dir ))
120
+ rereturned_status = script_runner .run (
121
+ ["jupyter" , "lite" , lite_hook ],
122
+ cwd = str (an_empty_lite_dir ),
123
+ )
120
124
duration_2 = time .time () - restarted
121
125
assert rereturned_status .success
122
126
123
- if not IS_PYPY :
127
+ if not ( IS_PYPY or IS_WIN ) :
124
128
# some caching doesn't seep to work reliably
125
129
assert duration_1 > duration_2
126
130
@@ -148,14 +152,16 @@ def test_cli_any_hook( # noqa: PLR0915
148
152
app_overrides .write_text (AN_OVERRIDES , encoding = "utf-8" )
149
153
150
154
forced_status = script_runner .run (
151
- "jupyter" ,
152
- "lite" ,
153
- lite_hook ,
154
- "--force" ,
155
- "--contents" ,
156
- str (readme ),
157
- "--contents" ,
158
- str (more ),
155
+ [
156
+ "jupyter" ,
157
+ "lite" ,
158
+ lite_hook ,
159
+ "--force" ,
160
+ "--contents" ,
161
+ str (readme ),
162
+ "--contents" ,
163
+ str (more ),
164
+ ],
159
165
cwd = str (an_empty_lite_dir ),
160
166
)
161
167
@@ -194,7 +200,7 @@ def test_cli_any_hook( # noqa: PLR0915
194
200
def test_cli_raw_doit (an_empty_lite_dir , script_runner ):
195
201
"""does raw doit work"""
196
202
returned_status = script_runner .run (
197
- "jupyter" , "lite" , "doit" , "--" , "--help" , cwd = str (an_empty_lite_dir )
203
+ [ "jupyter" , "lite" , "doit" , "--" , "--help" ] , cwd = str (an_empty_lite_dir )
198
204
)
199
205
assert returned_status .success
200
206
assert "http://pydoit.org" in returned_status .stdout
@@ -205,13 +211,13 @@ def test_build_repl_no_sourcemaps(an_empty_lite_dir, script_runner):
205
211
out = an_empty_lite_dir / "_output"
206
212
207
213
args = original_args = "jupyter" , "lite" , "build"
208
- status = script_runner .run (* args , cwd = str (an_empty_lite_dir ))
214
+ status = script_runner .run (args , cwd = str (an_empty_lite_dir ))
209
215
norm_files = sorted (out .rglob ("*" ))
210
216
assert status .success
211
217
assert [f for f in norm_files if f .name .endswith (".map" )], "expected maps"
212
218
213
219
args = [* args , "--apps" , "repl" , "--apps" , "foobarbaz" ]
214
- status = script_runner .run (* args , cwd = str (an_empty_lite_dir ))
220
+ status = script_runner .run (args , cwd = str (an_empty_lite_dir ))
215
221
repl_files = sorted (out .rglob ("*" ))
216
222
repl_bundles = sorted (out .glob ("build/*/bundle.js" ))
217
223
assert status .success
@@ -221,7 +227,7 @@ def test_build_repl_no_sourcemaps(an_empty_lite_dir, script_runner):
221
227
assert "'foobarbaz' is not one of" in status .stderr
222
228
223
229
args = [* args , "--no-unused-shared-packages" ]
224
- status = script_runner .run (* args , cwd = str (an_empty_lite_dir ))
230
+ status = script_runner .run (args , cwd = str (an_empty_lite_dir ))
225
231
no_chunk_files = sorted (out .rglob ("*" ))
226
232
# assert "pruning unused shared package" in status.stderr
227
233
@@ -230,15 +236,15 @@ def test_build_repl_no_sourcemaps(an_empty_lite_dir, script_runner):
230
236
assert len (no_chunk_files ) < len (repl_files ), f"unexpected { unexpected } "
231
237
232
238
args = [* args , "--no-sourcemaps" ]
233
- status = script_runner .run (* args , cwd = str (an_empty_lite_dir ))
239
+ status = script_runner .run (args , cwd = str (an_empty_lite_dir ))
234
240
min_files = sorted (out .rglob ("*" ))
235
241
assert status .success
236
242
237
243
assert not [f for f in min_files if f .name .endswith (".map" )], "expected no maps"
238
244
239
245
assert len (min_files ) < len (no_chunk_files ), "expected fewer files still"
240
246
241
- status = script_runner .run (* original_args , cwd = str (an_empty_lite_dir ))
247
+ status = script_runner .run (original_args , cwd = str (an_empty_lite_dir ))
242
248
rebuild_files = sorted (out .rglob ("*" ))
243
249
assert status .success
244
250
0 commit comments