Skip to main content

Driver-agnostic core for tquality test automation (Selenium, Appium, WinAppDriver, etc.)

Project description

tquality-py-core

Languages: English · Русский

Driver-agnostic core for the tquality test automation framework. Provides the foundation that driver-specific packages (Selenium, Appium, WinAppDriver) build on.

Components

  • BaseConfig — pydantic-settings configuration that loads from config.json5 (with comment and trailing-comma support via json5), environment variables and dotenv files. Subclass it to add driver-specific fields.
  • Logger, LogLevel, step — per-test logging with allure integration. Step levels: NORMAL, CRITICAL (screenshot at the end), WITH_SCREENCAST (step video via a pluggable provider).
  • BaseForm — base class for pages and forms (a page is just a form with the full context).
  • BaseElement — abstract interface implemented by driver-specific element types.
  • StringUtils — string-parsing helpers.

Out of scope

  • Concrete driver integrations (Selenium, Appium, WinAppDriver) — live in separate packages that depend on this core.
  • Element types (Button, Input, Label, etc.) — driver-specific implementations sit alongside the corresponding driver integration.
  • DI container wiring — every consumer assembles its own container via dependency-injector, registering both core services and driver-specific services.

Integration contract

Consumer packages must:

  1. Subclass BaseConfig with driver-specific fields.
  2. Register a Logger resolver via set_logger_resolver(lambda: YourServices.logger()), where YourServices is the consumer package's container. This lets step() from the core find the active Logger from any module.
  3. Where needed, implement ScreenshotProvider / ScreencastProvider and inject them into Logger through the container, so that CRITICAL steps attach screenshots and WITH_SCREENCAST steps attach a recording (the concrete format is up to the provider — for example webm in Selenium) to the allure report. Without providers the steps still pass, but with a warning in the log.
  4. Provide concrete BaseElement subclasses with their own lookup and wait logic.

Requirements

  • Python 3.12+

Installation

The package is published to public PyPI. This is the recommended installation path for all consumers:

pip install tquality-py-core

or with uv:

uv add tquality-py-core

In the consumer's pyproject.toml:

dependencies = [
    "tquality-py-core>=0.1.3",
]

Alternative: install from the GitHub mirror

For a source build (for example, to verify a commit that has not yet been released), the package is also available from the public GitHub mirror by tag:

uv pip install "tquality-py-core @ git+https://github.com/Tquality-ru/tquality-py-core.git@v0.1.3"

In that case hatch on the consumer side requires explicit opt-in to direct-references:

[tool.hatch.metadata]
allow-direct-references = true

CLI

After installation the tquality-config command is available:

tquality-config init        # generate config.json5 with default values
tquality-config schema      # generate schema/config.schema.json (for maintainers)

The generated config.json5 includes a reference to the JSON Schema published via jsDelivr. The address is automatically pinned to the package version: a released install (0.1.3) → @v0.1.3; an unreleased install (+g..., .dev) → @master:

{
    "$schema": "https://cdn.jsdelivr.net/gh/Tquality-ru/tquality-py-core@v0.1.3/schema/config.schema.json",
    // Comments are supported — useful to explain the chosen value.
    "base_url": "http://localhost",
    "default_timeout": 10.0,
    "log_dir": "logs",
    "highlight_elements": false,
}

Editors with JSON Schema support (VS Code, JetBrains IDEs) autocomplete the available fields and validate values. The jsonc/json5 syntax allows // and /* */ comments and trailing commas.

Development

See CONTRIBUTING.md for environment setup, git-hook installation and mypy type checking.

CI/CD

GitLab CI runs two checks on every MR and on master:

  • mypy — strict mode type checking.
  • tests — pytest with a JUnit report.

On a git tag vX.Y.Z:

  • publish-pypi — build (version derived from the tag via hatch-vcs) and upload to public PyPI. Requires the PYPI_TOKEN variable in CI/CD settings (protected, masked).
  • publish — duplicate publication to the GitLab Package Registry (internal mirror).
  • mirror-to-github — master and the tag are pushed to https://github.com/Tquality-ru/tquality-py-core (feature/* branches are not copied to the mirror).

Version history lives in CHANGELOG.md.

Why this exists

Separates universal patterns (logging, page objects, configuration loading) from driver-specific code. Appium and WinAppDriver reuse the same page-object model, step reporting and configuration pipeline without a hard dependency on Selenium.

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

tquality_py_core-0.1.5.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

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

tquality_py_core-0.1.5-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file tquality_py_core-0.1.5.tar.gz.

File metadata

  • Download URL: tquality_py_core-0.1.5.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tquality_py_core-0.1.5.tar.gz
Algorithm Hash digest
SHA256 0967a5dcd585f5f4e0fdbf3d25584ed9409d8ba0bc263aa7243b10682f151ffd
MD5 1bc647a7fbd0de1b1f2f0d4ed287998e
BLAKE2b-256 adc0de5e1c2b9ec24104a77480d8816d09e355289b78eba8d9426ab840cec01f

See more details on using hashes here.

File details

Details for the file tquality_py_core-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: tquality_py_core-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for tquality_py_core-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 825cb763816895b5391f5ad866d823ec8e7ffd916833d23bb63a763509d9db84
MD5 f6c6b073645b40cd207e9c204f8f0cbc
BLAKE2b-256 265eaa24265f38284b0b78369dfaddc2cfe0b58a968dc10355979917455a522a

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