Skip to content

Commit

Permalink
Replace sys.exit call in convert.py with a return statement, update u…
Browse files Browse the repository at this point in the history
…nit tests
  • Loading branch information
beeankha committed Aug 9, 2024
1 parent 7b0aef2 commit cd9751d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions conda_build/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import os
import re
import shutil
import sys
import tarfile
import tempfile
from pathlib import Path
Expand Down Expand Up @@ -819,7 +818,7 @@ def conda_convert(
else:
for c_extension in imports:
print(c_extension)
sys.exit()
return

if not show_imports and len(platforms) == 0:
raise CondaBuildUserError(
Expand Down
6 changes: 2 additions & 4 deletions tests/test_api_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def test_show_imports(base_platform, package, capfd):
download(f, fn)

for platform in platforms:
with pytest.raises(SystemExit):
api.convert(fn, platforms=platform, show_imports=True)
api.convert(fn, platforms=platform, show_imports=True)

output, error = capfd.readouterr()

Expand All @@ -81,8 +80,7 @@ def test_no_imports_found(base_platform, package, capfd):
fn = f"{package_name}-py36_0.tar.bz2"
download(f, fn)

with pytest.raises(SystemExit):
api.convert(fn, platforms=None, show_imports=True)
api.convert(fn, platforms=None, show_imports=True)

output, error = capfd.readouterr()
assert "No imports found." in output
Expand Down

0 comments on commit cd9751d

Please sign in to comment.