🛎 Test-import all modules 🛎
Individually and separately imports each Python module or file in a project and reports warnings or failures at the end.
Running impall as a unit test
Just inherit from the base class and it will automatically find and import each file, like this.
import impall
class ImpAllTest(impall.ImpAllTest):
pass
(You can copy this file into your project if you like.)
Tests are customized by overriding one of these following properties in the derived class.
CLEAR_SYS_MODULES, EXCLUDE, FAILING, INCLUDE, MODULES, PATHS,
RAISE_EXCEPTIONS, and WARNINGS_ACTION.
For example, to turn warnings into errors, set the property WARNINGS_ACTION in the derived class definition, like this.
class ImpAllTest(impall.ImpAllTest):
WARNINGS_ACTION = 'error'
Running impall as a command-line utility
$ impall --warnings_action=error
$ impall -w error
The properties INCLUDE, EXCLUDE, and PATHS can be lists of strings, or a string separated with colons like 'foo.mod1:foo.mod2'
INCLUDE and EXCLUDE match relative filesystem paths using fnmatch. Use the
platform path separator when providing a single string. For example,
INCLUDE = 'src/*.py' matches Python files directly beneath src.
A note on side-effects
to reduce side-effects, sys.modules is restored to its original
condition after each import if CLEAR_SYS_MODULES is true, but there might be
other side-effects from loading some specific module.
Use the EXCLUDE property to exclude modules with undesirable side effects. In general, it is probably a bad idea to have significant side-effects just from loading a module.
API Documentation
A note on AI use
Version 3.0 has exactly the same API as before, and the great majority of the code is still the handwritten code from before, but I recently used a coding assistant to find a lot of possible errors and edge cases and fix them.
I believe it should do exactly what it did before, but not fail in some unusual but certainly not impossible cases. Please let me know with an issue report if any problems crop up.
Metadata
Release files for impall 3.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| impall-3.0.1.tar.gz | 21.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| impall-3.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.2 kB
Release files / impall-3.0.1.tar.gz
| Download URL | impall-3.0.1.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a2271701180a04bcc5aab91b8a8aa15ea5273bb33975a8c4e7199c7e8e57ecf
|
|
BLAKE2b-256 checksum How to use checksums |
e012f0b1910270c643c820dc2438b2844a16079e3256e5287d9838c1c3f12488
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / impall-3.0.1-py3-none-any.whl
| Download URL | impall-3.0.1-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a230ad7b6a300b57885673b42a48aa8113eb8343f84b8377625ed22d7341e285
|
|
BLAKE2b-256 checksum How to use checksums |
19c3632dfe65155bf3c35f6650564755532f3b8427e188dc7157539024143589
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|