Skip to content

[Card Games]: Reformat lists_test.py by pylint to remove excess spaces. #2892

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 6 commits into from
Feb 5, 2022

Conversation

noritakaIzumi
Copy link
Contributor

@noritakaIzumi noritakaIzumi commented Feb 4, 2022

fixed:

  • trim whitespaces in the end of line
  • trim blanklines between pytest tasks (PEP 8)

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2022

Hi & Welcome! 👋🏽 👋

Thank you for contributing to exercism/python 💛 💙 -- we really appreciate it! 🌟 🌈


This is an automated [🤖 🤖  ] comment for the maintainers of this repository, notifying them of your contribution. 🎉
Someone will review/reply to your changes shortly. (usually within 72 hours.)
You can safely ignore the maintainers section below.


⚠️  Please be aware ⚠️

     This repo does not generally accept Pull Requests unless they follow our contributing guidelines and are:

     1️⃣     Small, contained fixes for typos/grammar/punctuation/code syntax on [one] exercise,
     2️⃣     Medium changes that have been agreed/discussed via a filed issue,
     3️⃣     Contributions from our [help wanted][help-wanted] issue list,
     4️⃣     Larger (previously agreed-upon) contributions from recent & regular (within the last 6 months) contributors.

    Pull Requests not in these categories will be closed. 😞



💙 It looks like you are changing/adding files in a Concept Exercise! 💙


‼️  Did You...

  •  Update & rebase your branch with any (recent) upstream changes.
  •  Spell and grammar check all prose changes.
  •  Run Prettier on all markdown and JSON files.
  •  Run flake8 with flake8 config to check general code style standards.
  •   Run pylint with pylint config to check extended code style standards.
  •  Use pytest or the python-track-test-runner to test any changed example.py/exemplar.pyfiles
     against their associated test files.
  •  Similarly, use pytest or the python-track-test-runner to test any changed test files.
    • Check that tests fail properly, as well as succeed.
       (e.g., make some tests fail on purpose to "test the tests" & failure messages).
  •  Double-check all files for proper EOL.
  •  Regenerate exercise documents when you modified or created a hints.md file for a practice exercise.
  •  Regenerate the test file if you modified or created a JinJa2 template file for a practice exercise.
    • Run the generated test file result against its example.py.
  •  Run configlet-lint if the track config.json, or any other exercise config.json has been modified.


✅️  Have You Checked:

.
Are there any additional changes you need to make?
Please make sure all associated files are present and consistent with your changes!

Concept Exercise Anatomy

  • .docs/hints.md
  • .docs/instructions.md
  • .docs/introduction.md
  • .meta/config.json
  • .meta/design.md
  • .meta/exemplar.py (exemplar solution)
  • <exercise-slug>_test.py (test file)
  • <exercise-slug>.py (stub file)
  • concepts/../introduction.md
  • concepts/../about.md
  • concepts/../links.json
  • concepts/../.meta/config.json

🛠️    Maintainers   

Please take note 📒 of the following sections/review items 👀 ✨



🌈  Acknowledgements and Reputation
  • ❓ Does this PR need to receive a label with a reputation modifier?
    • medium is awarded by default.
  • ❓ Does this contributor need to be added to the exercise authors or contributors?
  • ❓ Does this contributor need to be added to the concept authors or contributors?
  • ❓ Is there an associated issue or issues that should be linked to this PR?
💫  General Code Quality

    Verify:

    •  The branch was updated & rebased with any (recent) upstream changes.
    •  All prose was checked for spelling and grammar.
    •  Files are formatted via yapf (yapf config) & conform to our coding standards
    •  Files pass flake8 with flake8 config & pylint with pylint config.
    •  Changed example.py/exemplar.py files still pass their associated test files.
    •  Changed test files still work with associated example.py/exemplar.py files.
      • Check that tests fail properly, as well as succeed.
        (e.g., make some tests fail on purpose to "test the tests" & failure messages).
    •  All files have proper EOL.
    •  If a JinJa2 template was modified/created, was the test file regenerated?
      • Does the regenerated test file successfully test the exercises example.py file?
    •  The branch passes all CI checks & configlet-lint.


🌿  Changes to Concept Exercises
  • ❓ Are all required files still up-to-date & configured correctly for this change?_
  • ❓ Does <exercise>/.meta/design.md need to be updated with new implementation/design decisions
  • ❓ Do these changes require follow-on/supporting changes to related concept documents?
    ✨  Where applicable, check the following ✨

      (as a reminder: Concept Exercise Anatomy)

      • Exercise introduction.md
        • Do all code examples compile, run, and return the shown output?
        • Are all the code examples formatted per the Python docs?
      • Exercise instructions.md
      • Exercise hints.md
      • Check that exercise design.md was fulfilled or edited appropriately
      • Exercise exemplar.py
        • Only uses syntax previously introduced or explained.
        • Is correct and appropriate for the exercise and story.
      • Exercise <exercise_name>.py (stub)
        • Includes appropriate docstrings and function names.
        • Includes pass for each function
        • Includes an EOL at the end
      • Exercise <exercise_name>_test.py
        • Tests cover all (reasonable) inputs and scenarios
        • At least one test for each task in the exercise
        • If using subtests or fixtures they're formatted correctly for the runner
        • Classnames are <ExerciseName>Test
        • Test functions are test_<test_name>
      • Exercise config.json --> valid UUID4
      • Corresponding concept introduction.md
      • Corresponding concept about.md
      • Concept config.json
      • All Markdown Files : Prettier linting (for all markdown docs)
      • All Code files: PyLint linting (except for test files)
      • All files with text: Spell check & grammar review.
🚀  Changes to Practice Exercises

    Is the exercise is in line with Practice Exercise Anatomy?

    • .docs/instructions.md(required)
      • Was this file updated and regenerated properly?
    • .docs/introduction.md(optional)
    • .docs/introduction.append.md(optional)
    • .docs/instructions.append.md (optional)
      • Are any additional instructions needed/provided?
         (e.g. error handling or information on classes)
    • .docs/hints.md(optional)
      • Was this file regenerated properly?
    • .meta/config.json (required)
    • .meta/example.py (required)
      • Does this pass all the current tests as written/generated?
    • .meta/design.md (optional)
    • .meta/template.j2 (template for generating tests from canonical data)
      • Was a test file properly regenerated from this template?
    • .meta/tests.toml
      • Are there additional test cases to include or exclude?
      • Are there any Python-specific test cases needed for this exercise?
    • <exercise-slug>_test.py
      • Does this file need to be regenerated?
      • Does this file correctly test the example.py file?
      • Does this file correctly report test failures and messages?
    • <exercise-slug>.py (required)
      • Does this stub have enough information to get
         the student started coding a valid solution?
🐣  Brand-New Concept Exercises

    Is the exercise is in line with Concept Exercise Anatomy?

    • Exercise introduction.md
      • Do all code examples compile, run, and return the shown output?
      • Are all the code examples formatted per the Python docs?
    • Exercise instructions.md
    • Exercise hints.md
    • Check that exercise design.md was fulfilled or edited appropriately
    • Exercise exemplar.py
      • Only uses syntax previously introduced or explained.
      • Is correct and appropriate for the exercise and story.
    • Exercise <exercise_name>.py (stub)
      • Includes appropriate docstrings and function names.
      • Includes pass for each function
      • Includes an EOL at the end
    • Exercise <exercise_name>_test.py
      • Tests cover all (reasonable) inputs and scenarios
      • At least one test for each task in the exercise
      • If using subtests or fixtures they're formatted correctly for the runner
      • Classnames are <ExerciseName>Test
      • Test functions are test_<test_name>
    • Exercise config.json --> valid UUID4
    • Corresponding concept introduction.md
    • Corresponding concept about.md
    • Concept config.json
    • All Markdown Files : Prettier linting (for all markdown docs)
    • All Code files: Flake8 & PyLint linting
    • All Code Examples: proper formatting and fencing. Verify they run in the REPL
    • All files with text: Spell check & grammar review.


Our   💖   for all your review efforts! 🌟 🦄

Copy link
Member

@BethanyG BethanyG left a comment

Choose a reason for hiding this comment

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

@noritakaIzumi -- Thank you for this! 🌟

@BethanyG
Copy link
Member

BethanyG commented Feb 4, 2022

Humm, the CI is failing for this. Investigating.

Test to see if adding the trailing whitespace back in fixes CI failure.
Reverting prior change, as it was not a fix.
@noritakaIzumi
Copy link
Contributor Author

Is it ok if I tried to add a row to requirements.txt ?

The runner fails and prints the following in "canonical_sync":

ModuleNotFoundError: No module named 'toml'

I saw the module toml not in requirements.txt🤔

Test runner fails because of the following:
ModuleNotFoundError: No module named 'toml'
@noritakaIzumi
Copy link
Contributor Author

noritakaIzumi commented Feb 5, 2022

Pytest have released a new version yesterday.
And the module toml (missing module) is replaced with tomli

https://github.com/pytest-dev/pytest/releases/tag/7.0.0#:~:text=Switch%20TOML%20parser%20from%20toml%20to%20tomli

I think we have to specific version of pytest in canonical_sync.

In other words

.github/workflows/ci-workflow.yml line 69:

      run: pip install pytest

needs to be this

      run: pip install pytest~=6.2.5

(edit version number)

@BethanyG
Copy link
Member

BethanyG commented Feb 5, 2022

@noritakaIzumi Thank you for the offer of help. 😄

This is not exactly about a missing requirement -- at least not one in requirements.txt in this Python repo. When the CI runs, it builds our test runner by pulling it's requirements.txt and making a docker container. Then, from inside the container, it runs a script located in python/bin named test_exercises.py.

test_exercises.py imports data.py from the same directory. It's the data.py file that is failing on the toml import error. But it shouldn't be having that issue - so I think the error may be tagging off of something incorrect. That import has been there a looong time. It only started failing today, PST. Additionally, the same script running on my desktop is succeeding.

What did change today was the release of PyTest 7.0 (we were using 6.2.5). And since our requirements.txt only specifies a minimum version and not a max, the CI container got built with PyTest 7.0. Since that is what has most recently changed, I am attempting to confirm by testing on my machine. And I would love help -- if you are familiar/comfortable with docker and running pytest, et. al. 🌟

Basically, I am trying to figure out what changed to make the CI throw a fit over a toml import that has not changed. My working theory is that PyTest 7.0 has caused some sort of issue, that is manifesting with that error. But right now, I can't figure it out. 😢 I'm having issues getting the script to run manually from docker.

If it is PyTest 7.0, we can fix it by changing the requirements.txt for the runner, so that it forces PyTest 6.2.5....if that makes sense?

@BethanyG
Copy link
Member

BethanyG commented Feb 5, 2022

@noritakaIzumi -- didn't see your second comment -- YES! I think you are correct there -- we need to pin the version until we can figure out why PyTest 7.0 is making a mess of things.

@noritakaIzumi
Copy link
Contributor Author

@BethanyG I think so too.

Pin version of Pytest to ~6.2.5
@BethanyG
Copy link
Member

BethanyG commented Feb 5, 2022

and just like that! 😄 🎉

@noritakaIzumi -- care to PR a change to the runner requiremnts.txt, so that we make sure it doesn't pull PyTest 7.0 by accident? 😉 The repo is here: https://github.com/exercism/python-test-runner. And thank you for your sharp eyes, and for your troubleshooting.

@BethanyG BethanyG merged commit 6b39bec into exercism:main Feb 5, 2022
@noritakaIzumi
Copy link
Contributor Author

@BethanyG I got it 🥰

@BethanyG BethanyG changed the title refactor: reformat lists_test.py by pylint [Card Games]: Reformat lists_test.py by pylint to remove excess spaces. Feb 5, 2022
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.

2 participants