You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/gettingstarted.rst
+9-7Lines changed: 9 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -57,25 +57,27 @@ Sub or child namespaces may be nested using folders.
57
57
A namespace may be both a "leaf" and "branch" node in the source tree without any special configuration, as ``myproject.pkg`` is below.
58
58
Basilisp source files should always have a ``.lpy`` extension.
59
59
60
-
::
60
+
.. code-block:: text
61
61
62
62
.
63
63
├── README.md
64
64
├── poetry.lock
65
65
├── pyproject.toml
66
66
├── src
67
-
│ └── myproject
68
-
│ ├── core.lpy
69
-
│├── pkg
70
-
││ └── subns.lpy
71
-
│ └── pkg.lpy
67
+
│ └── myproject
68
+
│ ├── core.lpy
69
+
│ └── pkg
70
+
│ └── subns.lpy
71
+
│ └── pkg.lpy
72
72
└── tests
73
+
└── __init__.py
73
74
└── myproject
74
75
└── test_core.lpy
75
76
76
77
.. note::
77
78
78
-
Python ``__init__.py`` files are not required anywhere in Basilisp projects (including for nested namespaces), though you may need to use them if your project mixes Python and Basilisp sources.
79
+
Python ``__init__.py`` files are not required anywhere in Basilisp project source directories (including for nested namespaces), though you may need to use them if your project mixes Python and Basilisp sources.
80
+
A single ``__init__.py`` file may be required for running tests with Pytest -- see :ref:`testing_path` for more information.
79
81
80
82
Basilisp apps can use any of Python's myriad dependency management options, including `pip <https://pip.pypa.io/en/stable/>`_, `Pipenv <https://pipenv.pypa.io/en/latest/>`_, and `Poetry <https://python-poetry.org/>`_.
81
83
Basilisp itself uses Poetry and that is the recommended dependency management tool for new Basilisp projects.
Copy file name to clipboardExpand all lines: docs/testing.rst
+28Lines changed: 28 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,34 @@ For asserting repeatedly against different inputs, you can use the :lpy:fn:`are`
36
36
4 2 2
37
37
0 -1 1)
38
38
39
+
.. _testing_path:
40
+
41
+
Testing and ``PYTHONPATH``
42
+
--------------------------
43
+
44
+
Typical Clojure projects will have parallel ``src/`` and ``tests/`` folders in the project root.
45
+
Project management tooling typically constructs the Java classpath to include both parallel trees for development and only ``src/`` for deployed software.
46
+
Basilisp does not currently have such tooling (though it is planned!) and the recommended Python tooling is not configurable to allow for this distinction.
47
+
48
+
Due to this limitation, the easiest solution to facilitate test discovery with Pytest (Basilisp's default test runner) is to include a single, empty ``__init__.py`` file in the top-level ``tests`` directory:
49
+
50
+
.. code-block:: text
51
+
52
+
tests
53
+
├── __init__.py
54
+
└── myproject
55
+
└── core_test.lpy
56
+
57
+
Test namespaces can then be created as if they are part of a giant ``tests`` package:
58
+
59
+
.. code-block::
60
+
61
+
(ns tests.myproject.core-test)
62
+
63
+
.. note::
64
+
65
+
The project maintainers acknowledge that this is not an ideal solution and would like to provide a more Clojure-like solution in the future.
0 commit comments