Skip to content

Commit

Permalink
Improve reqs, tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evhub committed Oct 10, 2023
1 parent 440334b commit b1a5f43
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
12 changes: 8 additions & 4 deletions coconut/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,8 @@ def get_path_env_var(env_var, default):
("ipython", "py<3"),
("ipython", "py3;py<37"),
("ipython", "py==37"),
("ipython", "py38"),
("ipython", "py==38"),
("ipython", "py>=39"),
("ipykernel", "py<3"),
("ipykernel", "py3;py<38"),
("ipykernel", "py38"),
Expand All @@ -920,9 +921,10 @@ def get_path_env_var(env_var, default):
("jupyter-console", "py<35"),
("jupyter-console", "py>=35;py<37"),
("jupyter-console", "py37"),
("jupyterlab", "py35"),
("jupytext", "py3"),
"papermill",
# these are fully optional, so no need to pull them in here
# ("jupyterlab", "py35"),
# ("jupytext", "py3"),
),
"mypy": (
"mypy[python2]",
Expand Down Expand Up @@ -993,17 +995,19 @@ def get_path_env_var(env_var, default):
("jupyter-console", "py37"): (6, 6),
("typing", "py<35"): (3, 10),
("typing_extensions", "py>=37"): (4, 7),
("ipython", "py38"): (8, 15),
("ipykernel", "py38"): (6,),
("jedi", "py39"): (0, 19),
("pygments", "py>=39"): (2, 15),
("xonsh", "py38"): (0, 14),
("pytest", "py36"): (7,),
("async_generator", "py35"): (1, 10),
("exceptiongroup", "py37"): (1,),
("ipython", "py>=39"): (8, 15),

# pinned reqs: (must be added to pinned_reqs below)

# don't upgrade these; they breaks on Python 3.8
("ipython", "py==38"): (8, 12),
# don't upgrade these; they breaks on Python 3.7
("ipython", "py==37"): (7, 34),
# don't upgrade these; they breaks on Python 3.6
Expand Down
8 changes: 8 additions & 0 deletions coconut/tests/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,11 @@ def comp_38(args=[], always_sys=False, **kwargs):
comp(path="cocotest", folder="target_38", args=["--target", "38" if not always_sys else "sys"] + args, **kwargs)


def comp_311(args=[], always_sys=False, **kwargs):
"""Compiles target_311."""
comp(path="cocotest", folder="target_311", args=["--target", "311" if not always_sys else "sys"] + args, **kwargs)


def comp_sys(args=[], **kwargs):
"""Compiles target_sys."""
comp(path="cocotest", folder="target_sys", args=["--target", "sys"] + args, **kwargs)
Expand Down Expand Up @@ -605,6 +610,8 @@ def run(args=[], agnostic_target=None, use_run_arg=False, convert_to_import=Fals
comp_36(args, **spec_kwargs)
if sys.version_info >= (3, 8):
comp_38(args, **spec_kwargs)
if sys.version_info >= (3, 11):
comp_311(args, **spec_kwargs)

comp_agnostic(agnostic_args, **kwargs)
comp_sys(args, **kwargs)
Expand Down Expand Up @@ -646,6 +653,7 @@ def comp_all(args=[], agnostic_target=None, **kwargs):
comp_35(args, **kwargs)
comp_36(args, **kwargs)
comp_38(args, **kwargs)
comp_311(args, **kwargs)
comp_sys(args, **kwargs)
comp_non_strict(args, **kwargs)

Expand Down
3 changes: 3 additions & 0 deletions coconut/tests/src/cocotest/agnostic/main.coco
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def run_main(outer_MatchError, test_easter_eggs=False) -> bool:
if sys.version_info >= (3, 8):
from .py38_test import py38_test
assert py38_test() is True
if sys.version_info >= (3, 11):
from .py311_test import py311_test
assert py311_test() is True

print_dot() # .......
from .target_sys_test import TEST_ASYNCIO, target_sys_test
Expand Down
10 changes: 10 additions & 0 deletions coconut/tests/src/cocotest/target_311/py311_test.coco
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def py311_test() -> bool:
"""Performs Python-3.11-specific tests."""
multi_err = ExceptionGroup("herp", [ValueError("a"), ValueError("b")])
got_err = None
try:
raise multi_err
except* ValueError as err:
got_err = err
assert repr(got_err) == repr(multi_err), (got_err, multi_err)
return True

0 comments on commit b1a5f43

Please sign in to comment.