Skip to content

Conversation

@wanlin31
Copy link
Collaborator

@wanlin31 wanlin31 commented Sep 12, 2025

This change is required to accommodate the Python test suite's recording file directory structure.

Currently, our ~2000 Python tests organize recordings into module-specific subfolders. This structure is critical for maintainability and makes it easier to locate specific recording files.

To reduce test overhead and avoid duplicate pytest configurations, we use a single, session-scoped test server. The problem is that this server only accepts one root record_dir configuration when it starts, which would result in all 2,000 recordings being saved into one flat directory.

This pr implementing the logic needed for the single-session server to correctly generate test recordings into their appropriate, module-specific subdirectories.

Behavior:

  • When the directory exist: nothing would happen
  • When the directory exist: create the directory

Tested with the python test-server sample, attached the change.

@wanlin31 wanlin31 requested a review from Annhiluc September 12, 2025 15:13
@wanlin31 wanlin31 marked this pull request as ready for review September 12, 2025 15:13
@wanlin31 wanlin31 requested a review from hkt74 September 12, 2025 15:13
print("[PyTest] Making request to test-server proxy for www.github.com...")

custom_headers = {
'Test-Name': 'models/python-sample-test',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add a test for multiple layers? e.g., foo/bar/test-name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, now we have test with just a single file name and name with path

@wanlin31 wanlin31 merged commit 10f149b into google:main Sep 15, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants