Skip to content

Refactor tests and metadata #317

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

Merged
merged 5 commits into from
Mar 11, 2025
Merged

Conversation

aaronliu0130
Copy link
Member

@aaronliu0130 aaronliu0130 commented Mar 4, 2025

Note

We should remove the pylint warning suppression on getopt when the next release of pylint comes out due to getopt becoming deprecated for like 3 months

Reduce duplication of sample tests through parameterization, making pytest (and unittest) list the individual now-filterable tests (closes #260)

  • Replace duplicative testing of headers in boost's exclude.def with something where the --exclude parameter actually has an effect
  • Took the opportunity to lint CLI tests and migrate .popen() to .run()

Update fields of pyproject.toml

  • merge pylint config
  • make version dynamic
  • better list of maintainers and major authors
  • remove "test" extra which now just duplicates "dev"
  • remove weird duplicated "testing" extra
  • remove setuptools—a build-system.requires—from optional requirements
  • remove unneeded pytest alias
  • more and better keywords (this is PyPI, we don't need a "Python" keyword
  • shorter desc

cclauss
cclauss previously requested changes Mar 4, 2025
@cclauss
Copy link
Member

cclauss commented Mar 4, 2025

In the commit message, is it a new version of pytest or of pylint?

@aaronliu0130
Copy link
Member Author

The commit messages correctly said pytest; my note at the top about a new version of pylint didn't.

del fun
return f'test{x.args[0].capitalize()}Sample-{x.args[1]}'

@parameterized.expand([(folder, case[:-4])
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need https://github.com/wolever/parameterized that has had no update in two years, when pytest has https://docs.pytest.org/en/stable/how-to/parametrize.html#parametrize builtin?

Copy link
Member Author

Choose a reason for hiding this comment

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

That was the first thing I tried. I couldn't get that to work with the unittest-module–subclass setup in this repo. (Plas speling is very importent.)

Copy link
Member

Choose a reason for hiding this comment

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

It is not tested on Python 3.12, 3.13, and pytest > v3 (current is v8). See the open issues and

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, this seems like the best thing we have. We could always find an alternative solution later. It doesn't seem like parameterized's actual functionality we use has been impacted by their indeed-worrying neglect yet. (This was a reason I also tried the subtests approach, which works without additional modules but doesn't allow for -k filtering.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

With #332 I do not see why we need unittest.TestCase classes. I will do more work on that today.

Copy link
Member Author

@aaronliu0130 aaronliu0130 Mar 10, 2025

Choose a reason for hiding this comment

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

I think we'd have a less messy branch history if we just merge this now while you work on that.

Copy link
Member

Choose a reason for hiding this comment

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

#322 has now removed all instances of unittest.TestCase.

@aaronliu0130
Copy link
Member Author

aaronliu0130 commented Mar 8, 2025

Interestingly, the pre-commit CI is complaining about something that's not even part of this PR's base yet. Will rebase.

@aaronliu0130
Copy link
Member Author

@jayvdb @cclauss Hopefully we can merge this and release 2.0.1 soon!

self.assertEqual(0, status)
self.assertEqual(b'', out)
self.assertTrue(err.startswith(b'\nSyntax: cpplint'))

class TemporaryFolderClassSetup(object):

class TemporaryFolderClassSetup(unittest.TestCase):
Copy link
Member

Choose a reason for hiding this comment

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

Why this change?

Can we remove it and use pytest parameterize instead of the unmaintained library?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

This is just a linting thing to show the override hints in PyCharm. It works exactly the same without this change.

I've mentioned that subtests were tried and not filterable in a comment above.

Copy link
Member

Choose a reason for hiding this comment

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

You tried with pytest-subtests instead of wolever/parameterized?

Copy link
Member Author

@aaronliu0130 aaronliu0130 Mar 10, 2025

Choose a reason for hiding this comment

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

I don't think parameterized even has subtests support. Yes, I tried both unitest's own subtests and pytest-subtests. See pytest-dev/pytest-subtests#100.

Copy link
Member

@cclauss cclauss Mar 10, 2025

Choose a reason for hiding this comment

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

#332 has now removed all instances of unittest.TestCase.

@aaronliu0130 aaronliu0130 requested a review from cclauss March 10, 2025 13:06
@aaronliu0130
Copy link
Member Author

aaronliu0130 commented Mar 10, 2025 via email

@cclauss
Copy link
Member

cclauss commented Mar 11, 2025

Please rebase this so we can merge it.

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

I approve this after:

  1. The git conflicts are cleared, and
  2. All GitHub Actions tests pass.

* merge pylint config
* make version dynamic
* better list of maintainers and major authors
* remove "test" extra which now just duplicates "dev"
* remove weird duplicated "testing" extra
* remove setuptools—a build-system.requires—from optional requirements
* remove unneeded pytest alias
* more and better keywords (this is PyPI, we don't need a "Python" keyword
* shorter desc
fix a typo in the bulleted list
remove specific python version
aaronliu0130 and others added 3 commits March 11, 2025 18:16
Yep, I forgot the purpose of something I coded myself.

subprocess.run() is Python's recommended replacement to popen that doesn't need context management
@aaronliu0130 aaronliu0130 merged commit c0af6db into cpplint:develop Mar 11, 2025
10 checks passed
@aaronliu0130 aaronliu0130 deleted the metarefactor branch March 11, 2025 22:29
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.

Split clitests
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy