mirror of
https://github.com/danieldemus/pyp2spec.git
synced 2026-07-27 21:00:37 +02:00
Alongside with the license-related code the tests were significantly refactored to run offline. The changes are intertwined and so shipped in a single commit. The licensing changes: - updated Trove-Fedora mappings (removed Callaway expressions, added SPDX) - delegated the compliance check of Fedora licenses to a source maintained by the Fedora Legal team - the logic of license processing was moved to a dedicated module: license_processor The testing changes: - moved betamax configuration to conftest.py to achieve a reliable global setting - mocked fedora licensing data and PyPI package data to stop making unnecessary requests - most of the betamax cassettes were deleted - several tests rewritten, many added - regenerated remaining betamax cassettes This is a best-effort solution which can't (nor aims to) cover all edge-cases. Unless Python adopts SPDX standard, this will always be an approximation.
20 lines
608 B
Python
20 lines
608 B
Python
import json
|
|
|
|
import betamax
|
|
import pytest
|
|
|
|
|
|
config = betamax.Betamax.configure()
|
|
config.cassette_library_dir = "tests/fixtures/cassettes"
|
|
# only replay recorded cassettes -
|
|
# error if an actual HTTP request would be necessary
|
|
# this is to prevent packaging issues in the offline environment (like rpm build)
|
|
# change to 'once' to enable recording new cassettes when writing new tests
|
|
config.default_cassette_options["record_mode"] = "none"
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def fake_fedora_licenses():
|
|
with open("tests/fedora_license_data.json", "r", encoding="utf-8") as f:
|
|
return json.load(f)
|