-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix parallel logging in Python tests #2532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
👷 Deploy request for selenium-dev pending review.Visit the deploys page to approve it
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
User description
Description
This PR fixes some Python test failures. Several tests were failing with
PermissionError. The reason for this is that we run tests in parallel using thepytest-xdistplugin. The logging tests all use a common fixture (log_path). This fixture generates a log file name and deletes the file when each test completes. The problem is that when running tests in parallel, multiple tests were using the same log file name and attempting to delete the file while other tests were still using it. I updated the fixture to use a UUID in the file name instead of a timestamp to make sure log file names are unique.I also added a few things to
.gitignoreand fixed the import order in.conftest.py.Motivation and Context
Tests were failing when run in parallel.
Types of changes
Checklist
PR Type
Bug fix, Tests
Description
Fixed parallel test failures by using UUID for log file names
Replaced timestamp-based naming with UUID to ensure unique log files
Corrected import order in conftest.py for PEP 8 compliance
Added color output flag to pytest command in tox.ini
Diagram Walkthrough
File Walkthrough
conftest.py
Use UUID for unique log file namingexamples/python/tests/conftest.py
ensure uniqueness
import uuidstatementlocal)
log_pathfixture to use f-string withuuid.uuid4()instead oftimestamp
tox.ini
Add color output to pytest commandexamples/python/tox.ini
{tty:--color=yes}flag to pytest command for colored output