Skip to content

cli command basilisp test does not work with Python 3.12.7 #1119

@ikappaki

Description

@ikappaki

Hi,

the basilisp test cli command does not work with Basilisp 3.12:
basilisp test: error: the following arguments are required: args

To reproduce

  1. With Python 3.12 as the main interpreter, create a new project with Poetry, and basilisp and pytest as dependencies, and shell to it
> poetry new issue-test-312
Created package issue_test_312 in issue-test-312
> cd issue-test-312
> poetry add basilisp
Using version ^0.3.0 for basilisp
...
> poetry add pytest
Using version ^8.3.3 for pytest
...
> poetry shell
Spawning shell within D:\rissue-test-312\.venv
...
> python --version
Python 3.12.7
  1. Run basilisp test the error comes up
> basilisp test
usage: basilisp test [-h] [--generate-auto-inlines [GENERATE_AUTO_INLINES]] [--inline-functions [INLINE_FUNCTIONS]]
                     [--warn-on-arity-mismatch [WARN_ON_ARITY_MISMATCH]]
                     [--warn-on-shadowed-name [WARN_ON_SHADOWED_NAME]] [--warn-on-shadowed-var [WARN_ON_SHADOWED_VAR]]
                     [--warn-on-unused-names [WARN_ON_UNUSED_NAMES]]
                     [--warn-on-non-dynamic-set [WARN_ON_NON_DYNAMIC_SET]]
                     [--use-var-indirection [USE_VAR_INDIRECTION]]
                     [--warn-on-var-indirection [WARN_ON_VAR_INDIRECTION]]
                     [--include-unsafe-path [INCLUDE_UNSAFE_PATH]] [-p INCLUDE_PATH]
                     [--data-readers-entry-points [DATA_READERS_ENTRY_POINTS]] [--disable-ns-cache [DISABLE_NS_CACHE]]
                     [--enable-logger [ENABLE_LOGGER]] [-l LOG_LEVEL]
                     [--emit-generated-python [EMIT_GENERATED_PYTHON]]
basilisp test: error: the following arguments are required: args

The same works fine on Python 3.11

> python --version
Python 3.11.4
> poetry new issue-test-311
Created package issue_test_311 in issue-test-311
> cd .\issue-test-311\
> poetry add basilisp
Creating virtualenv issue-test-311 in D:\issue-test-311\.venv
Using version ^0.3.0 for basilisp
...
> poetry add pytest
Using version ^8.3.3 for pytest
...
> poetry shell
Spawning shell within D:\removeme\bas\issue-test-311\.venv
...
> basilisp test
================================================= test session starts =================================================
platform win32 -- Python 3.11.4, pytest-8.3.3, pluggy-1.5.0
rootdir: D:\issue-test-311
configfile: pyproject.toml
plugins: basilisp-0.3.0
collected 0 items

================================================== warnings summary ===================================================
.venv\Lib\site-packages\_pytest\config\__init__.py:1277
  D:\issue-test-311\.venv\Lib\site-packages\_pytest\config\__init__.py:1277: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: basilisp
    self._mark_plugins_for_rewrite(hook)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================= 1 warning in 0.03s ==================================================

I had a quick look and it seems possible that the error is caused by the negative argument passed to nargs below? I couldn't find anything about negative values in the argparse nargs section of the python documentation, perhaps that was undocumented behavior that has gone away? Maybe an alternative option would be to use an explicit argument such as --pytest-args to signify the arguments to pytest?

basilisp/cli.py

def _add_test_subcommand(parser: argparse.ArgumentParser) -> None:
    parser.add_argument("args", nargs=-1, help="arguments passed on to Pytest")

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    component:cliIssue pertaining to Basilisp CLIissue-type:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions