FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-106368: Argument Clinic: Add tests for cloned functions with custom C base names by erlend-aasland · Pull Request #107977 · python/cpython · GitHub

/ cpython Public

gh-106368: Argument Clinic: Add tests for cloned functions with custom C base names - #107977

Merged
erlend-aasland merged 6 commits into
python:mainfrom
erlend-aasland:clinic/add-cloned-with-custom-c-basename-test
Aug 15, 2023
Merged

gh-106368: Argument Clinic: Add tests for cloned functions with custom C base names#107977
erlend-aasland merged 6 commits into
python:mainfrom
erlend-aasland:clinic/add-cloned-with-custom-c-basename-test

Conversation

erlend-aasland commented Aug 15, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

AlexWaygood 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

There is still one case in this block that is untested:

cpython/Tools/clinic/clinic.py

Lines 4888 to 4890 in e28b0dc

if (is_legal_py_identifier(full_name) and
(not c_basename or is_legal_c_identifier(c_basename)) and
is_legal_py_identifier(existing)):

What if is_legal_py_identifier(full_name) evaluates to True, not c_basename evaluates to False, is_legal_c_identifier(c_basename) evaluates to False and is_legal_py_identifier(existing) evaluates to True?

I.e., if I apply this diff to your PR branch, the assertion is never triggered:

-            if (is_legal_py_identifier(full_name) and
-                (not c_basename or is_legal_c_identifier(c_basename)) and
-                is_legal_py_identifier(existing)):
+            if is_legal_py_identifier(full_name) and is_legal_py_identifier(existing):
+                if c_basename:
+                    assert is_legal_c_identifier(c_basename)

...Could you also add a test with a cloned function with a custom C base name where the custom C base name is not a legal C identifier?

Copy link
Copy Markdown
Member

I'm getting warnings about the execution environment when I'm running python -m test test_clinic -v with this PR branch locally, btw:

Ran 243 tests in 0.620s

OK
Warning -- files was modified by test_clinic
Warning --   Before: []
Warning --   After:  ['clinic/']
Warning -- files was modified by test_clinic
Warning --   Before: []
Warning --   After:  ['clinic/']
test_clinic failed (env changed)

== Tests result: SUCCESS ==

1 test altered the execution environment:
    test_clinic

Total duration: 1.2 sec
Tests result: SUCCESS

Copy link
Copy Markdown
Member

I'm getting warnings about the execution environment when I'm running python -m test test_clinic -v with this PR branch locally, btw:

Ah, and it looks like the CI is complaining about the same thing: https://github.com/python/cpython/actions/runs/5868181574/job/15910445072

Copy link
Copy Markdown
Contributor Author

I'm getting warnings about the execution environment when I'm running python -m test test_clinic -v with this PR branch locally, btw:

Ah, and it looks like the CI is complaining about the same thing: https://github.com/python/cpython/actions/runs/5868181574/job/15910445072

Ah, yeah, I noticed earlier today, but got sidetracked. Since we're running a "expect success" test, we will actually generate clinic output in the added test (hence the sudden clinic/ directory). A workaround is to register a cleanUp() method, another is to just suppress all output, and yet another, is to run a destination file clear at the end of the clinic input.

Copy link
Copy Markdown
Contributor Author

I wonder why we're not seeing complaints about clinic/ directories for the other self.clinic.parse tests...

Copy link
Copy Markdown
Contributor Author

I wonder why we're not seeing complaints about clinic/ directories for the other self.clinic.parse tests...

... because they don't create output; either they're dumping to block or buffer, or they're testing some weird directive, or they're run with precomputed checksums in the input (hence no regenerated output).

Copy link
Copy Markdown
Contributor Author

...Could you also add a test with a cloned function with a custom C base name where the custom C base name is not a legal C identifier?

Ah, good call. On it!

AlexWaygood changed the title gh-106368: Argument Clinic: Add test for cloned function with custom C base name gh-106368: Argument Clinic: Add tests for cloned functions with custom C base names Aug 15, 2023

AlexWaygood 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks great, thank you!

Copy link
Copy Markdown
Contributor Author

thank you!

Likewise!

erlend-aasland deleted the clinic/add-cloned-with-custom-c-basename-test branch August 15, 2023 20:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL