GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-108303: Move all XML-related test files to `test_xml` by sobolevn · Pull Request #114344 · python/cpython

Conversation

@sobolevn

@sobolevn sobolevn commented Jan 20, 2024 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There should be a lot of changed files, but history should be clean.

  • Issue: Move test files into test subdirectories #108303

📚 Documentation preview 📚: https://cpython-previews--114344.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sobolevn
pythongh-108303: Move all XML-related test files to test_xml
3f7f7f2
@sobolevn sobolevn added skip news needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Jan 20, 2024
@sobolevn
sobolevn requested a review from vstinner January 20, 2024 12:17
@bedevere-app bedevere-app Bot added the awaiting review label Jan 20, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Jan 20, 2024
Move test files into test subdirectories #108303
Closed
serhiy-storchaka
serhiy-storchaka reviewed Jan 21, 2024
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

test_xmlrpc and test_docxmlrpc are not XML tests.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
sobolevn added 2 commits January 21, 2024 19:52
@sobolevn
Do not touch xmlrpc
57e9b75
@sobolevn
Do not touch xmlrpc
13fdbc7
@vstinner

vstinner commented Jan 22, 2024

Copy link
Copy Markdown
Member

Hum, I don't get the PR description. So, what it does:

Create test_xml test package

* Create a new test_xml test package.
* Declare test_xml as a test package in libregrtest (findtests.py).
* Move the 7 tests to test_xml: test_minidom.py, test_pulldom.py,
  test_pyexpat.py, test_sax.py, test_xml_dom_minicompat.py,
  test_xml_etree_c.py and test_xml_etree.py.
* Move Lib/test/xmltestdata/ to Lib/test/test_xml/xmltestdata/.

It changes also findfile() of test.support: if subdir is not a string, use os.path.join(subdir). Is the findfile() needed? One option would to be avoid one level of directories: move the 5 test files from Lib/test/test_xml/xmltestdata/ to Lib/test/test_xml/ as done in other test packages. But keep c14n-20/ in a subdirectory.

What do you think about removing xmltestdata/ subdirectory @sobolevn?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka

serhiy-storchaka commented Jan 22, 2024

Copy link
Copy Markdown
Member

I do not think that it is worth to do. Unlike to asyncio or email, xml is not a single package. It is a set of unrelated packages in a common parent namespace.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn

sobolevn commented Jan 23, 2024

Copy link
Copy Markdown
Member Author

@serhiy-storchaka sorry, I don't agree. They might have any implementation details, but they are still sharing the same namespace and they use the same fixture files. It is logical for test to have the same namespaces as regular code does.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn
sobolevn force-pushed the issue-108303-test_xml branch from af1b057 to 13fdbc7 Compare January 23, 2024 10:27
@sobolevn
Better findfile docs
55274c2
@sobolevn

sobolevn commented Jan 23, 2024

Copy link
Copy Markdown
Member Author

@vstinner I tried to remove xmltestdata/ directory, but I didn't go too well.
Since it relies on some exotic line-ending rules and possibly other magic stuff, I would say that keeping it as-is the same simplest and the safest thing we can do.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vstinner
vstinner requested changes Jan 23, 2024
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I suggest to close this issue.

There are different aspects:

  • Is it possible to run individual tests separately? Like test_xml.test_test_minidom. Yes, it's possible.
  • Does the change increase parallelism of tests, or make it worse? Same, since regrtest splits test_xml into sub-tests to run them in parallel.
  • Are these sub-tests related? How? Well, there are related to "XML". Their implementations are unrelated. xml.minidom implementation has nothing to do with xml.etree.

@sobolevn:

they are still sharing the same namespace and they use the same fixture files. It is logical for test to have the same namespaces as regular code does.

We have many "os-like" and "socket-like" tests in separated tests, and that's why we have helpers such as support.os_helper and support.socket_helper. I don't buy the argument "putting everything at the same place is better".

While it's very tempting to put "everything related to XML" in a test package, for this change, I prefer to stick to the status quo: "flat namespace is better than nested" (PEP 20) :-)

Not changing tests keeps the Git history linear (no custom command line option needed) and avoids developers to change their habits. I don't think that the benefits are way higher than drawbacks (moving code).

Test files are already in the xmltestdata directory.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting changes and removed awaiting review labels Jan 23, 2024
@bedevere-app

bedevere-app Bot commented Jan 23, 2024

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn

sobolevn commented Jan 23, 2024

Copy link
Copy Markdown
Member Author

Ok, sounds convincing 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sobolevn sobolevn closed this Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka serhiy-storchaka left review comments
@vstinner vstinner vstinner requested changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting changes needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@sobolevn @vstinner @serhiy-storchaka
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.