@@ -285,20 +285,25 @@ def test_query_logic_precendence(tmp_path, expr, expected):
285
285
assert num_lines == int (expected )
286
286
287
287
288
+ # fmt: off
288
289
@pytest .mark .parametrize (
289
- ("args" , "vcf_name" ),
290
+ ("args" , "vcf_name" , "bcftools_error_string" ),
290
291
[
291
- ("index -ns" , "sample.vcf.gz" ),
292
- ("query -f '%POS\n ' -i 'INFO/DP > 10' -e 'INFO/DP < 50'" , "sample.vcf.gz" ),
293
- ("view -i 'INFO/DP > 10' -e 'INFO/DP < 50'" , "sample.vcf.gz" ),
292
+ ("index -ns" , "sample.vcf.gz" , True ),
293
+ ("query -f '%POS\n ' -i 'INFO/DP > 10' -e 'INFO/DP < 50'" , "sample.vcf.gz" , True ), # noqa: E501
294
+ ("view -i 'INFO/DP > 10' -e 'INFO/DP < 50'" , "sample.vcf.gz" , True ),
295
+ # bcftools output does not start with "Error"
296
+ ("view -i 'FILTER=\" F\" '" , "sample.vcf.gz" , False ),
294
297
],
295
298
)
296
- def test_error (tmp_path , args , vcf_name ):
299
+ # fmt: on
300
+ def test_error (tmp_path , args , vcf_name , bcftools_error_string ):
297
301
vcf_path = pathlib .Path ("tests/data/vcf" ) / vcf_name
298
302
vcz_path = vcz_path_cache (vcf_path )
299
303
300
304
_ , bcftools_error = run_bcftools (f"{ args } { vcf_path } " , expect_error = True )
301
- assert bcftools_error .startswith ("Error:" ) or bcftools_error .startswith ("[E::" )
305
+ if bcftools_error_string :
306
+ assert bcftools_error .startswith ("Error:" ) or bcftools_error .startswith ("[E::" )
302
307
303
308
_ , vcztools_error = run_vcztools (f"{ args } { vcz_path } " , expect_error = True )
304
309
assert "Error:" in vcztools_error
0 commit comments