Inelegant, a directory of weird helpers for tests.
Project description
“Inelegant” is a set of not very elegant tools to help testing. So far there are nine packages:
inelegant.net: the most important tools are the waiter functions. inelegant.net.wait_server_down() will block until a port in a host is not accepting connections anymore, and inelegant.net.wait_server_up() will block until a port in the host will be ready for receiving data. There is also inelegant.net.Server, that sets up a very dumb SocketServer.TCPServer subclass for testing.
inelegant.finder: contains the inelegant.finder.TestFinder class. It is a unittest.TestSuite subclass that makes the task of finding test cases and doctests way less annoying.
inelegant.module: with inelegant.module.create_module(), one can create fully importable Python modules. inelegant.module.installed_module() will create and remove the importable module. There are other related functions.
inelegant.process: home of inelegant.process.Process, a nice multiprocessing.Process subclass that makes the process of starting, stopping and communicating with a function in another process easier enough.
inelegant.fs: tools for file system operations. Most notably, context managers to make such operations reverted. So, now once can “cd” into a directory and be back to the original one, create a temporary file and have it automatically deleted after the context, and the same with temporary directories.
inelegant.dict: it provides the temp_key() context manager. It adds a key to a dictionary and, once its context is done, removes the key.
inelegant.toggle: it provides the Toggle class. It is used to create flags to enable global behaviors. A toggle is, indeed, something you would rather avoid but may need.
inelegant.io: tools to process standard input/output/error. Right now it has four context managers: redirect_stdout() and redirect_stderr(), that redirect the standard output and the standard error, respectively, to a file, and suppress_stdout() and suppress_stderr(), that only discard content written to these files.
inelegant.object: currently, it has a context manager/decorator to set and restore attributes.
For more info, check the project page.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file inelegant-0.3.0.tar.gz
.
File metadata
- Download URL: inelegant-0.3.0.tar.gz
- Upload date:
- Size: 36.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e3747cf1794743d24979fba17e9ec9ff9c3d3586f031d704ca63c443731effe |
|
MD5 | f1614070dfd33de7384a5efdce3f36e1 |
|
BLAKE2b-256 | 76cf0180365f56119e02917c1d133fdefb25660052fb76735de11573caa15349 |