Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evhub committed Feb 25, 2024
1 parent ccfc882 commit b65e25e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions coconut/tests/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@
)

mypy_snip = "a: str = count()[0]"
mypy_snip_err_2 = '''error: Incompatible types in assignment (expression has type\n"int", variable has type "unicode")'''
mypy_snip_err_3 = '''error: Incompatible types in assignment (expression has type\n"int", variable has type "str")'''
mypy_snip_err = '''error: Incompatible types in assignment (expression has type'''

mypy_args = ["--follow-imports", "silent", "--ignore-missing-imports", "--allow-redefinition"]

Expand Down Expand Up @@ -427,6 +426,7 @@ def comp(path=None, folder=None, file=None, args=[], **kwargs):

def rm_path(path, allow_keep=False):
"""Delete a path."""
print("DELETING", path)
path = os.path.abspath(fixpath(path))
assert not base_dir.startswith(path), "refusing to delete Coconut itself: " + repr(path)
if allow_keep and get_bool_env_var("COCONUT_KEEP_TEST_FILES"):
Expand Down Expand Up @@ -856,23 +856,23 @@ def test_target_3_snip(self):
def test_universal_mypy_snip(self):
call(
["coconut", "-c", mypy_snip, "--mypy"],
assert_output=mypy_snip_err_3,
assert_output=mypy_snip_err,
check_errors=False,
check_mypy=False,
)

def test_sys_mypy_snip(self):
call(
["coconut", "--target", "sys", "-c", mypy_snip, "--mypy"],
assert_output=mypy_snip_err_3,
assert_output=mypy_snip_err,
check_errors=False,
check_mypy=False,
)

def test_no_wrap_mypy_snip(self):
call(
["coconut", "--target", "sys", "--no-wrap", "-c", mypy_snip, "--mypy"],
assert_output=mypy_snip_err_3,
assert_output=mypy_snip_err,
check_errors=False,
check_mypy=False,
)
Expand All @@ -889,7 +889,8 @@ def test_import_hook(self):
with using_coconut():
auto_compilation(True)
import runnable
reload(runnable)
if not PY2: # triggers a weird metaclass conflict
reload(runnable)
assert runnable.success == "<success>"

def test_find_packages(self):
Expand Down

0 comments on commit b65e25e

Please sign in to comment.