Skip to main content

Asynchronous API wrapper for the Open Build Service

Project description

Ruff

py-obs is a simple asynchronous python API wrapper for the Open Build Service.

Testing

The following commands will launch a local OBS instance using docker compose:

$ ./start-mini-obs.sh
$ ./configure-mini-obs.sh

Afterwards, you can run the integration tests agains the local instance via:

$ poetry run pytest -vv

Recording interactions with build.opensuse.org

It can be undesirable to setup packages on the local test instance. We use pytest-recording to record the HTTP requests against OBS for faster unit tests and for not requiring an account for testing.

To create a test which runs against OBS, create a test function with the following markers:

@pytest.mark.vcr(filter_headers=["authorization", "openSUSE_session"])
@pytest.mark.asyncio
async def test_something_against_obs(osc_from_env: OSC_FROM_ENV_T) -> None:
    async for osc in osc_from_env:
        # now we can do something with osc
        pass

The filter_headers is crucial here, as otherwise you’ll record your password & session.

To record the interaction, run the tests once as follows:

$ OSC_USER=$my_obs_account OSC_PASSWORD=$my_obs_password \
      poetry run pytest -vv -k something_against_obs

Replace something_against_obs with the name of your test function (minus the leading test_) or some other filter, to only run this one test function.

A new cassette file should show up in tests/cassettes. Do not forget to commit it into git.

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

py_obs-0.0.2.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

py_obs-0.0.2-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file py_obs-0.0.2.tar.gz.

File metadata

  • Download URL: py_obs-0.0.2.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for py_obs-0.0.2.tar.gz
Algorithm Hash digest
SHA256 976367563e7f4886c8a87c56369ae2703a50e987848b8ca89b9506c21dc76f60
MD5 4544fe2a1856bc3bcc24b65dbfb27bd0
BLAKE2b-256 4219d09e57eb2e1e9ce7c2188f22a44a621cef59bf424e241b5db3be4007c54a

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_obs-0.0.2.tar.gz:

Publisher: release.yml on dcermak/py-obs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_obs-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: py_obs-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for py_obs-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 909806f788725e7a44579f8164f953f44124f1d313e173a522dc27da562eb194
MD5 c24f7b5ecea1a51ecb836e722ea79d17
BLAKE2b-256 9df26866e4a7cd49f54f32027e81f5ffddea3bf4a2ad6c43c5cccf1ac061b9d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_obs-0.0.2-py3-none-any.whl:

Publisher: release.yml on dcermak/py-obs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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