Skip to content

Observes unit tests

To develop a unit test, add it to the correspongin environment folder, for example, observes/etl/gitlab/tests:

def test_check_url_components() -> None:
#Test implementation goes here
  • Entering the testing environment:

    To access the testing environment, navigate to the Observes directory in the Universe repository. Within this directory, you will find various subdirectories corresponding to different archtecture components and products. Observes is responsible for Extract, Transform, Load (ETL) processes, which involve data tranpsportation. Inside the etl directory you’ll find several bash scripts. Since these scripts are not written in Python, there is no linting process invovled.

    Once your test is ready, format your code by running this command within the universe repository:

    Terminal window
    m . /formatBash

    Subproducts of Observes, such as etl, singer, contain separate Python packages. Each subproduct can be imported independently and has its own isolated environment.

    To enter the environment, navigate to the desired subproduct directory, for example /observes/singer/tap-delighted

    Ensure you have direnv installed and execute direnv allow to activate the environment. You can verify the Python interpreter being used with the command which python. This Python interpreter is unique to each product and includes all necesary dependencies and libraries.

  • Running tests:

    Our unit test run in our CI/CD pipeline, every time a developer pushes changes to our repository.

    Tests are located in the test directory of each subproduct. While there is a test job in the CI pipleine located at observes/singer/tap-delighted/check/tests, you can also run tests manually with the command:

    Terminal window
    pytest ./tests

    Each environment’s test are distinguished by the path of each subproduct. For example, when in the GitLab environment, tests specific to that environment are automatically detected.

Note: Unit tests must be reproducible and pass consistently. If tests fail, the package build process will not execute properly, as the tests are integrated into the build.