What is the problem or limitation you are having?
If you want to use tests via the --test option, according to the docs you currently need to have a module such as tests.myapp to startup the tests.
The module name myapp is derived from the app name, but the package tests in which the module must be located is fixed. test_sources allows you to include any folder, but currently there must be at least one folder called tests that contains the main test module.
In Python, it is often common for the tests to be located in a tests folder, but this folder can also have a different name. Therefore, it would be good to have a configuration option for the main test package.
Describe the solution you'd like
There should be a configuration option test_main_package that allows you to configure the name of the main test package.
Describe alternatives you've considered
Leave everything as it is. The main package must always be called tests. However, the documentation for test_sources should make it clearer that it must contain a folder called tests.
Additional context
My current problem is that I want to run the integration tests of the BLE library Bleak on Android and iOS. Currently, these run on macOS/Linux/Window normally via pytest in a venv. However, in order to test these platforms on Android and iOS, I need a sample app in which the tests are integrated. For this purpose, I want to create a briefcase application, which should be located under /examples/briefcase. My desired project structure is as follows:
- bleak (already existing library source code)
- __init__.py
- ...
- tests (already existing library tests)
- integration
- test_scanner.py
- test_client.py
- ...
- ...
- examples
- briefcase
- src
- tests_startup
- bleak_example.py
- pyproject.toml
My examples/briefcase/pyproject.toml should look like this:
[tool.briefcase.app.bleak_example]
...
test_main_package = "tests_startup"
test_sources = [
"tests_startup",
"../../tests"
]
I could, of course, simply move the file examples/briefcase/tests_startup/bleak_example.py to tests/bleak_example.py and remove the tests_startup folder entirely, but I don't want to modify the existing tests folder at all.
What is the problem or limitation you are having?
If you want to use tests via the
--testoption, according to the docs you currently need to have a module such astests.myappto startup the tests.The module name
myappis derived from the app name, but the packagetestsin which the module must be located is fixed.test_sourcesallows you to include any folder, but currently there must be at least one folder calledteststhat contains the main test module.In Python, it is often common for the tests to be located in a
testsfolder, but this folder can also have a different name. Therefore, it would be good to have a configuration option for the main test package.Describe the solution you'd like
There should be a configuration option
test_main_packagethat allows you to configure the name of the main test package.Describe alternatives you've considered
Leave everything as it is. The main package must always be called
tests. However, the documentation fortest_sourcesshould make it clearer that it must contain a folder calledtests.Additional context
My current problem is that I want to run the integration tests of the BLE library Bleak on Android and iOS. Currently, these run on macOS/Linux/Window normally via pytest in a venv. However, in order to test these platforms on Android and iOS, I need a sample app in which the tests are integrated. For this purpose, I want to create a briefcase application, which should be located under
/examples/briefcase. My desired project structure is as follows:My
examples/briefcase/pyproject.tomlshould look like this:I could, of course, simply move the file
examples/briefcase/tests_startup/bleak_example.pytotests/bleak_example.pyand remove thetests_startupfolder entirely, but I don't want to modify the existingtestsfolder at all.