Skip to content

Assertion error when running basilisp test wihtout speicfying a path #1204

@ikappaki

Description

@ikappaki

Hi

there appears to be an general issue with Basilisp 0.3.6 when running basilisp test without explicitly specifying a path:

AssertionError: Must have at least one module name

To reproduce,

  1. create a new Poetry Basilisp project, and create a tests/issue_test.lpy file with a minimal test case (or clone https://github.com/ikappaki/issue-bas-test-path-dot)
(ns tests.issue-test
  (:require [basilisp.test :refer [deftest is]]))

(deftest abc
  (is (= 5 0)))
  1. Run basilisp test the above error is returned:
$ poetry run basilisp test
=================================================== test session starts ===================================================
platform win32 -- Python 3.11.4, pytest-8.3.4, pluggy-1.5.0
rootdir: d:\bas\issue-bas-test-path-dot
configfile: pyproject.toml
plugins: basilisp-0.3.6
collected 0 items / 1 error

__________________________________________ ERROR collecting tests/issue_test.lpy __________________________________________
.venv\Lib\site-packages\basilisp\contrib\pytest\testrunner.py:270: in collect
    module = self._import_module()
.venv\Lib\site-packages\basilisp\contrib\pytest\testrunner.py:247: in _import_module
    assert modnames, "Must have at least one module name"
E   AssertionError: Must have at least one module name
E   assert []
...

A workaround is to include the FQD name of the project directory when running basilisp test:

$ poetry run basilisp test -p <project dir>
platform win32 -- Python 3.11.4, pytest-8.3.4, pluggy-1.5.0
rootdir: d:\bas\issue-bas-test-path-dot
configfile: pyproject.toml
plugins: basilisp-0.3.6
collected 1 item

tests\issue_test.lpy F                                                                                               [100%]

___________________________________________________________ abc ___________________________________________________________
FAIL in (abc) (issue_test.lpy:5)
    Test failure: (= 5 0)

    expected: 5
      actual: 0
...

This issue seems to be related to a regression in (#1176), which I thought I previously tested with success, but it was in a slightly more complex setup that did not cover this basic case.

PR to follow.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions