
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Alternative unittest test runner with colourised output and per-test coverage support, from the devs of getbenchmarked.io.
It extends the standard :code:unittest.TextTestRunner
class, with a bunch of tweaks:
colorama
library is installed, the dot or the test outcome text is printed in colourscoverage
package is installed, and the coverage_sources
parameter is set on the
runner, it will measure test coverage, both for each test, and overallrerun_log
parameter, tests that fail or raise an exception are collected
in the specified file, so they can be re-run laterWhen verbosity is above one (thus, per-test coverage report is printed), it can’t print the overall coverage data. We are working on it.
Right now, the library only supports Python 3, and probably won’t run in Python 2 without a lot of tweaks. As we use only Python 3 at getbenchmarked.io, we didn’t have the intention to support Python 2; if you need it and do the tweaks, please send us a PR!
Recommended installation is via pip, inside a virtualenv
To get it from PyPI::
$ pip install gt2_test_runner
If you want a bleeding-edge version from GitHub::
$ pip install -e git+https://github.com/GT2-io/gt2-test-runner#egg=gt2-test-runner
Downloading the package source and installing it yourself is also an option. To do so::
$ python setup.py
There are no hard dependencies for this pacakage.
colorama
packagecoverage
packageCollecting tests ''''''''''''''''
To collect tests programatically, we provide the filter_tests
helper function:
.. code-block:: python
test_suite = filter_tests('tests')
test_suite = filter_tests(existing_suite, selector=['test_module', 'test_module2.TestCase'])
test_suite = filter_tests('tests', selector=['test_module', 'test_module2.TestCase'])
Measuring coverage data '''''''''''''''''''''''
To measure coverage data, you have to pass the files to be included in the coverage report. If
you want to collect all your source files automatically, you can use the collect_sources
helper
function.
.. code-block:: python
source_files = collect_sources('.')
Running the tests '''''''''''''''''
To run a test suite with GT2Runner
, you can use the following example:
.. code-block:: python
tests = filter_tests('tests')
runner = GT2Runner(verbosity=1, failfast=False, rerun_log='rerun-log.txt', coverage_sources=collect_sources('.'))
result = runner.run(tests)
result.coverage_report(save_data=True, html_dir='htmlcov', to_stream=True)
FAQs
unittest test runner with colourised output and per-test coverage support
We found that gt2-test-runner demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.