Skip to content

Can't run tests in namespaces defined with underscores #1165

Closed
@ikappaki

Description

@ikappaki

Hi,

I can't seem to be able to run tests whose namespace is in camecase

To reproduce

  1. create the following test structure in the basilisp codebase
.
└── test1
        ├── __init__.py
        └── issue
                ├── __init__.py
                └── a_test.lpy   
  1. In a_test.lpy, create a namespace matching the filename in camel case (which is valid)
(ns test1.issue.a_test
  (:require [basilisp.test :refer [deftest is]]))

(deftest abc-test
  (is (= 5 6)))
  1. Run the test in that directory, no tests are either detected or ran
> basilisp test test1
================================================================== test session starts ===================================================================
platform win32 -- Python 3.13.0, pytest-8.3.3, pluggy-1.5.0
rootdir: C:\src\basilisp
configfile: pyproject.toml
plugins: anyio-4.6.2.post1, basilisp-0.3.3, pycharm-0.7.0
collected 0 items

The same works as expected if you switch the _ with -, i.e. from test1.issue.a_test to test1.issue.a-test:

(ns test1.issue.a-test
  (:require [basilisp.test :refer [deftest is]]))

(deftest abc-test
  (is (= 5 6)))
> basilisp test test1
================================================================== test session starts ===================================================================
platform win32 -- Python 3.13.0, pytest-8.3.3, pluggy-1.5.0
rootdir: C:\src\basilisp
configfile: pyproject.toml
plugins: anyio-4.6.2.post1, basilisp-0.3.3, pycharm-0.7.0
collected 1 item

test1\issue\a_test.lpy F                                                                                                                            [100%]

FAIL in (abc-test) (a_test.lpy:5)
    Test failure: (= 5 6)

    expected: 5
      actual: 6

The same also works in Clojure.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions