Skip to main content

It contains common elements for testing purposes...

Project description

This project contains basic elements for testing purposes and the ability to run (via console commands) tests and code coverage (unittest-based). This way, we can stick to the DRY – Don’t Repeat Yourself principle and avoid code duplication in each python project where tests coverage and tests execution are expected…


Python Versions License Pipeline Status Docs Status Security

How to Use

Install the package

pip install core-tests

Create entry-point

# manager.py

from click.core import CommandCollection
from core_tests.tests.runner import cli_tests

if __name__ == "__main__":
    cli = CommandCollection(sources=[cli_tests()])
    cli()

Shell commands

Running tests

python manager.py run-tests --test-type unit
python manager.py run-tests --test-type integration
python manager.py run-tests --test-type "another folder that contains test cases under ./tests"
python manager.py run-tests --test-type functional --pattern "*.py"

Using PyTest

The unittest framework cannot discover or run pytest-style tests, it is designed to discover and run tests that are subclasses of unittest.TestCase and follow its conventions. Pytest-style tests (i.e., functions named test_* that are not inside a unittest.TestCase class, or tests using pytest fixtures, parametrize, etc.) are not recognized by unittest’s discovery mechanism, unittest will simply ignore standalone test functions and any pytest-specific features…

That’s why you can use PyTest if required.

pip install .[pytest]
python manager.py run-tests --engine pytest

Test coverage

python manager.py run-coverage                  # For `unittest` framework...
python manager.py run-coverage --engine pytest  # For `PyTest`...

Execution Environment

Install libraries

pip install --upgrade pip
pip install virtualenv

Create the Python Virtual Environment

virtualenv --python={{python-version}} .venv
virtualenv --python=python3.11 .venv

Activate the Virtual Environment

source .venv/bin/activate

Install required libraries

pip install .

Check tests and coverage…

python manager.py run-tests
python manager.py run-coverage

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

core_tests-2.0.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

core_tests-2.0.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file core_tests-2.0.0.tar.gz.

File metadata

  • Download URL: core_tests-2.0.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for core_tests-2.0.0.tar.gz
Algorithm Hash digest
SHA256 71b39d818b335da782d61050a57c16afa63aec6a8418553d3c00895e457b014b
MD5 4e75e18364045c309c62305fa0ea71f2
BLAKE2b-256 ecb3a275949f94f834ed74d8c4d5a8cab2c535be341a8068978b68971da38794

See more details on using hashes here.

File details

Details for the file core_tests-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: core_tests-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for core_tests-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 756dac1a5a63bb403363a4d5b4fa63c627dff4fb34578aedc46b4e32c16ad1d1
MD5 297aeaeb14c5c5f5d432c27c7380f133
BLAKE2b-256 c7b6d6108c1bec9d9014b6a0c1816cae2e6bea4011cafa0479e87f1dae702502

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page