Skip to main content

It contains common elements for testing purposes...

Project description

core-tests


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...

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-1.1.5.tar.gz (5.0 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-1.1.5-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: core_tests-1.1.5.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for core_tests-1.1.5.tar.gz
Algorithm Hash digest
SHA256 af7cdb606aa5afd4ca773883172736fa86ae9cbd26be8b151b863099b9fd46e5
MD5 271002343bae836d0d7865498b7a54ab
BLAKE2b-256 490c7d9bd1c1aba69c62781ee1624b2a7b24fedb7a44bdc49d772b54f4da1510

See more details on using hashes here.

File details

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

File metadata

  • Download URL: core_tests-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for core_tests-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c3565d45a7803a8b3227cd40731d1d57e32de8e85369816654725fd9147b750f
MD5 eefebaf9914ad2a8c6504c55fbc3dc30
BLAKE2b-256 0170d5932e1006f8d8eeabbb43fefd5f534b15d3d85e23f127df1f0817064317

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