Rights and contracts
Software test fixture licensing: data the code license does not cover
By SourceX Editorial · Reviewed by Noah Loul ·
10 sections
Short answer
Review test fixtures as data, not as code. A repository's license covers what the company wrote, but recorded API responses, saved web pages, open data extracts, sample documents and media in test folders keep their own owners and terms. Inventory every fixture file, record where its content came from and what terms govern it, then keep, regenerate or exclude it before the code goes into a licensing review.
License terms
Software test fixture
Key takeaways
- A repository license is the code owner's grant and cannot cover content that someone else owns, even when it sits in the tests folder.
- Recorded API cassettes store the vendor's real response body; credential filters do not change who owns that data.
- Open data in fixtures brings attribution and share-alike conditions that may not fit a restricted or exclusive training license.
- Give every fixture an audit row that ends in keep, regenerate, exclude or hold, with the evidence a rights reviewer can check.
- Ship the licensed copy from a filtered export built from the audit, and rotate any leaked credential before filtering.
Why does the repository license stop at the fixtures folder?
A repository's license is a grant from whoever owns the code, so it can only cover material that owner holds rights in. Data copied into test fixtures from a vendor API, a public website, an open map or a customer's files arrives with its own owner and its own terms, and those terms travel with the bytes no matter which folder they sit in.
GitHub's documentation describes the starting point plainly: without a license, default copyright applies and the author keeps all rights to the source code, so nobody may reproduce, distribute or adapt it. The same logic runs in reverse for fixtures. A file you did not author is governed by its author's terms, and the LICENSE file at the top of your repository says nothing about it.
The pytest documentation shows why this matters for test suites in particular. It defines a fixture as the defined, reliable context a test runs in, which can be an environment such as a configured database or content such as a dataset. Content is exactly what ends up licensed when a code repository goes into an AI training or evaluation deal, so the fixture folder is where the code license and the data question meet.
Which fixture types usually carry someone else's data?
Most third-party fixture data falls into a handful of recognizable families, and each has a typical origin and a typical default. Use the table as the first sort before any file-level review; the provenance audit below then confirms or overturns the default for each file.
| Fixture type | Typical origin | Whose terms govern it | Default before review |
|---|---|---|---|
| Recorded HTTP cassettes and API snapshots | Live calls to a payment, shipping, mapping or CRM vendor during test setup | The vendor's API or developer terms, plus any data about the vendor's other customers in the response | Hold until the API terms are read; plan to regenerate |
| Saved web pages and scraped HTML | A developer saving a real page to test a parser | The site owner's copyright and terms of use | Exclude |
| Open data extracts | OpenStreetMap tiles or XML, Wikipedia text, government datasets | The open license named by the publisher, often with attribution or share-alike conditions | Keep only with the license recorded and counsel sign-off |
| Sample documents and forms | Vendor invoices, carrier labels, bank statements or PDFs a customer sent with a bug report | The issuer or the customer, and often a confidentiality clause | Exclude, or replace with a synthetic document |
| Media: images, fonts, audio, video | Stock libraries, screenshots, test images found online | The media license, which may restrict machine learning use | Exclude unless the license is on file |
| Golden outputs from third-party tools | Expected results produced by a commercial tool or service | Possibly the tool vendor's output terms | Hold until the tool terms are read |
| Test corpora vendored from another project | A benchmark or sample set copied from an open source repository | That project's license, which may differ from its code license | Keep only with the license recorded |
| Production or customer exports | Rows copied from a live system to reproduce a bug | The customer agreement and privacy law | Exclude; handle as personal data |
What does a recorded API cassette actually store?
A cassette stores the real response a third-party service sent your test, headers and body included, and replays it on later runs. The VCR.py documentation says this is the point: after the first recording, replayed responses contain the same headers and body you would get from a real request, so the test is fast and deterministic even offline.
That accuracy is what makes cassettes a licensing problem. A recorded call to a shipping rate API holds the carrier's rate data; a recorded CRM call can hold another tenant's account names if the test pointed at a shared sandbox; a recorded search call holds whatever the search provider returned that day. None of that content was written by your engineers.
VCR.py's filtering options are built for a different risk. Its documentation describes filter_headers, filter_query_parameters and filter_post_data_parameters for keeping authentication details such as an authorization header or an api_key parameter out of cassettes checked into source control. Those filters strip credentials from the request; they do not remove or relicense the vendor's data in the response body. Treat a cleaned cassette as a secret-free copy of someone else's output, not as first-party code.
Do attribution and share-alike terms follow open data into a test?
Yes. Open licenses are permissions with conditions, and the conditions apply to the copy in your tests folder just as they apply anywhere else. Two common examples show the shape of the obligation.
OpenStreetMap's copyright page says its data is licensed under the Open Data Commons Open Database License: you may copy, distribute, transmit and adapt the data as long as you credit OpenStreetMap and its contributors, and if you alter or build on the data you may distribute the result only under the same license. A map extract used to test a routing function carries those terms into any dataset built from the repository.
Creative Commons Attribution-ShareAlike 4.0, the license on a great deal of reusable text, requires that if you share adapted material, the license you apply to your contributions must be a Creative Commons license with the same license elements, this version or later, or a BY-SA compatible license. That can sit badly with an exclusive or restricted training license, because the open terms are not yours to narrow.
The practical decision is not whether open data is allowed, but whether its conditions can be met inside the deal you are planning. If attribution can be carried and the share-alike reach is acceptable to counsel, keep the fixture with its license recorded. If not, regenerate the fixture from synthetic input or leave it out.
The fixture provenance and exclusion audit
The audit is one row per fixture file (or per directory when every file in it shares an origin), and each row ends in one of four decisions: keep, regenerate, exclude or hold. The fields below are the minimum a rights reviewer needs to agree with the decision without reopening the repository.
- Keep: the content is first-party (generated by your code from inputs your team wrote) or its license is recorded and its obligations can be met in the planned deal.
- Regenerate: the test needs realistic content but not this content; replace it with synthetic data or a recording against your own sandbox, then re-audit the new file.
- Exclude: the content belongs to a customer, a website owner or a media library, carries a no-ML or confidentiality condition, or has no traceable origin.
- Hold: the terms exist but their reach is unclear, such as an API agreement silent on stored responses; route to counsel and keep the file out of any delivery until decided.
| Field | What to record | Evidence that settles it | Stop condition |
|---|---|---|---|
| Path and content hash | Repository path and a SHA-256 of the file at the audited commit | The audited commit ID and a hash listing | File changed after the audit commit |
| Fixture kind | One of the families in the sort table | File type, the test that loads it, the directory convention | Kind cannot be determined |
| First commit and author | The commit that added the file and the committer identity | git log with the add filter and follow on the path | Added in a bulk import with no message |
| Content origin | The system, site, vendor or person the content came from | Commit message, linked ticket, recording script, or the author's statement | Origin unknown after asking the author |
| Governing terms | License identifier, API terms version, or contract reference | The license text or terms page saved with its date | Terms cannot be found or are paywalled |
| Obligations | Attribution, share-alike, no-ML, non-commercial or confidentiality conditions | The relevant clause quoted in the row | Any no-ML or confidentiality clause |
| Personal or customer data | Whether names, emails, account IDs or customer content appear | Scan output plus a manual read of a sample | Any personal or customer data found |
| Regeneration path | Whether a synthetic or self-recorded replacement can keep the test meaningful | A replacement fixture and a passing test run | Test loses its purpose without the real data |
| Decision and reviewer | Keep, regenerate, exclude or hold, with the reviewer's name and date | Reviewer sign-off in the audit file | Engineering and rights reviewer disagree |
How should licensing information be recorded next to each fixture?
Record it in the repository, next to the file, so the decision survives copies and moves. The REUSE specification from the Free Software Foundation Europe gives a ready convention: every covered file must have licensing information associated with it, through a comment header, a REUSE.toml file, or for files that cannot hold comments, an adjacent text file with the extra extension .license, such as cat.jpg.license for cat.jpg.
JSON cassettes, images and PDFs are exactly those uncommentable files, so a .license companion or a REUSE.toml covering a cassette directory is the natural fit. Name the actual rights holder in the copyright line and the actual terms in the license line; for vendor API terms that have no SPDX identifier, a LicenseRef entry pointing to a saved copy of the terms keeps the record honest.
Two limits matter. REUSE's own FAQ says the goal is to declare licensing metadata, not to check whether that metadata is correct or valid, and that it does not resolve license compatibility. A green REUSE lint result proves every fixture has a label, not that the label is right. The audit row, with its evidence, is what a rights reviewer relies on.
Worked audit (illustrative): a logistics SaaS test suite
This example is invented to show the method; the company, counts and outcomes are illustrative. A logistics software company plans to include its main service repository in a code dataset. The fixture sort finds 1,180 fixture files across 14 directories.
The audit settles most of them quickly. 640 files are JSON payloads generated by the company's own factories from hand-written inputs, so they are first-party and kept. 310 are cassettes recorded against two carrier rate APIs; in this illustration the carriers' developer terms restrict storing and redistributing rate responses, so the team regenerates them against a mock carrier the company wrote, and the tests still exercise the same parsing paths. 140 are OpenStreetMap extracts used to test routing; counsel decides the share-alike condition does not fit the planned exclusive license, so the team swaps in synthetic road graphs for 120 of them and excludes the 20 that test real-world edge cases.
The remaining 90 files need more care. 62 are PDFs of bills of lading that customers attached to support tickets; they are excluded and logged as customer data. 28 are screenshots from a stock library used in UI snapshot tests; the license on file prohibits machine learning use, so they are excluded too. The final audit lists 1,180 rows with decisions: 640 keep, 430 regenerated, 110 excluded, none on hold.
Excluding a fixture from the delivered copy without rewriting your main history
Build the licensed copy from a filtered export rather than editing the company's working repository. Deleting a fixture in a new commit leaves it in every earlier commit, and a code dataset that ships history ships those commits too.
GitHub's guidance on removing sensitive data explains why rewriting the live repository is costly: commit hashes change for the affected commit and every later one, collaborators' old clones can re-push the removed data, closed pull requests lose their diff views, and commit signatures are dropped. For a licensing deliverable, producing a separate filtered snapshot or history export, built from the audit file's exclusion list, avoids all of that while giving the buyer a copy that never contained the excluded files.
If a cassette held a live credential, the order matters. GitHub's guidance says the first step for a leaked secret is to revoke or rotate it, because a rotated secret can no longer be used even if a copy survives somewhere. Rotate first, then filter.
Can a separate reviewer rebuild the environment and confirm the tests still prove something?
They should be able to, and the audit should make it routine. Excluding or regenerating fixtures changes what the test suite checks, and a buyer evaluating code for training or evaluation will care whether the tests that remain still pass and still mean something.
At a glance
Can a separate reviewer rebuild the environment and confirm the tests still prove something
- Pin the audited commit, the language runtime and dependency lockfile in the audit header so the run can be repeated.
- Run the suite before and after the exclusions and record pass, fail and skip counts for each run.
- Mark tests that depended on an excluded fixture as skipped with a reason that names the audit row, rather than deleting them silently.
- Have a second engineer regenerate three fixtures from the documented regeneration path and confirm the hashes or the assertions match.
- Sample at least one row from every fixture family and have the rights reviewer re-check the evidence column against the file.
- Stop and escalate if the second reviewer cannot reproduce a keep decision from the recorded evidence.
Bringing an audited repository into a licensing conversation
A finished fixture audit answers one of the first questions a rights review asks about any code set: which files the company can actually license. Engineering organizations licensing repositories or other operating records can lean on SourceX for rights review, contracting, preparation and delivery; the opening step is a company assessment that needs no code or data, and no files ship before the scope and terms are approved and the agreement signed.
Frequently asked questions
Does my repository's license cover the JSON files in my tests folder?
Only the files your company wrote or generated. A LICENSE file is a grant from the code's owner, so it cannot extend to vendor API responses, scraped pages, open data or customer documents that were copied into fixtures. Those keep their original owners' terms.
Are recorded API cassettes safe to include in a code dataset?
Not by default. A cassette stores the real response body from a third-party service, and filtering options in tools like VCR.py remove credentials, not the vendor's data. Read the vendor's API terms, then regenerate the cassette against your own mock or sandbox if storage or redistribution is restricted.
Can I keep OpenStreetMap or Wikipedia text in fixtures if I add attribution?
Attribution is only part of it. OpenStreetMap data is under the ODbL and much reusable text is under CC BY-SA 4.0; both carry share-alike conditions on adapted material. Counsel should confirm those conditions fit the planned license before the fixture stays in.
Is replacing third-party fixtures with synthetic data enough?
Usually, if the synthetic data is generated from inputs your team wrote and the replacement is audited like any other fixture. Check that the replacement does not quietly copy structure or values from the original, and rerun the tests to confirm they still exercise the same code paths.
Who should sign off on a fixture provenance audit?
An engineering lead who knows how the fixtures are used and a rights reviewer who can read the governing terms. Contract or license questions that change a keep or exclude decision go to counsel, who reviews the specific facts.
Sources
- GitHub: without a license, default copyright laws apply and the author retains all rights to the source code. Source
- pytest: a fixture provides a defined, reliable and consistent context for tests, including content such as a dataset. Source
- VCR.py records a test's HTTP request to a cassette and replays the response with the same headers and body as a real request. Source
- VCR.py can filter authentication headers, query parameters and post data so they do not appear in cassettes checked into source control. Source
- OpenStreetMap data is licensed under the ODbL; users must credit OpenStreetMap and its contributors and share altered data only under the same license. Source
- CC BY-SA 4.0 requires the adapter's license on shared adapted material to be a CC license with the same elements or a BY-SA compatible license. Source
- REUSE 3.3 requires licensing information for every covered file, using comment headers, REUSE.toml, or a .license file beside uncommentable files. Source
- REUSE declares licensing metadata but does not check that it is correct or resolve license compatibility. Source
- GitHub: rewriting history to remove data has side effects such as changed hashes and recontamination risk, and a leaked secret should first be revoked or rotated. Source
See if your company qualifies
A short company assessment. No data uploads are needed.