Skip to content

gh-139322: Remove redundant test_os.Win32ErrorTests - #139477

Merged
vstinner merged 4 commits into
python:mainfrom
vstinner:remove_win32_error_tests
Oct 2, 2025
Merged

gh-139322: Remove redundant test_os.Win32ErrorTests#139477
vstinner merged 4 commits into
python:mainfrom
vstinner:remove_win32_error_tests

Conversation

@vstinner

@vstinnervstinner commented Oct 1, 2025

Copy link
Copy Markdown
Member

test_os OSErrorTests already covers the OSError class and is more complete than Win32ErrorTests.

test_os OSErrorTests already covers the OSError class and is more
complete than Win32ErrorTests.
@bedevere-appbedevere-appBot added the tests Tests in the Lib/test dir label Oct 1, 2025
@picnixzpicnixz changed the title gh-139322: Remove test_os Win32ErrorTestsgh-139322: Remove redundant test_os.Win32ErrorTestsOct 1, 2025
@vstinner

Copy link
Copy Markdown
MemberAuthor

cc @serhiy-storchaka

Comment threadLib/test/test_os/test_os.py Outdated
filename = os_helper.TESTFN
self.addCleanup(os_helper.unlink, filename)
create_file(filename)
self.assertRaises(OSError, os.mkdir, filename)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe test for more concrete OSError subclass? It is FileExistsError on Linux.

Also, NotADirectoryError for os.path.join(filename, 'subdir') and FileNotFoundError for os.path.join(filename, 'subdir') if filename does not exist,

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Let me try with FileExistsError.

@serhiy-storchakaserhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. 👍

But if we add a new test, I suggest to add also tests for os.path.join(filename, 'subdir'), before and after creation of filename. AFAIK, this is not tested.

@vstinner
vstinner merged commit af01b46 into python:mainOct 2, 2025
43 checks passed
@vstinner
vstinner deleted the remove_win32_error_tests branch October 2, 2025 18:46
@vstinner

Copy link
Copy Markdown
MemberAuthor

Merged. I added more tests on chdir() errors.

@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 CentOS9 NoGIL Refleaks 3.x (tier-1) has failed when building commit af01b46.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1610/builds/2155) and take a look at the build logs.
  4. Check if the failure is related to this commit (af01b46) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1610/builds/2155

Failed tests:

  • test_free_threading

Test leaking resources:

  • test_free_threading: file descriptors

Summary of the results of the build (if available):

==

Click to see traceback logs
remote: Enumerating objects: 7, done. remote: Counting objects: 20% (1/5) remote: Counting objects: 40% (2/5) remote: Counting objects: 60% (3/5) remote: Counting objects: 80% (4/5) remote: Counting objects: 100% (5/5) remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 50% (1/2) remote: Compressing objects: 100% (2/2) remote: Compressing objects: 100% (2/2), done. remote: Total 7 (delta 3), reused 3 (delta 3), pack-reused 2 (from 1) 
From https://github.com/python/cpython
* branch main -> FETCH_HEAD
Note: switching to 'af01b4686613ec712f803959f0dba4e34d07ae3e'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at af01b468661 gh-139322: Remove redundant `test_os.Win32ErrorTests` (#139477)
Switched to and reset branch 'main'
configure: WARNING: no system libmpdec found; falling back to pure-Python version for the decimal modulemake: *** [Makefile:2487: buildbottest] Error 2

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@vstinner@bedevere-bot@serhiy-storchaka