Skip to content
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

test(pipenv): Rewrite test mocks #29734

Merged
merged 14 commits into from
Jul 2, 2024

Conversation

zharinov
Copy link
Collaborator

@zharinov zharinov commented Jun 18, 2024

Changes

Prepare the codebase for usage of external detect-tools package: mock fs-extra instead of internal fs utils.

This should make our extracted code to act as drop-in replacement with no other changes required. The alternative could be mocking of the detect-tools itself, but in this case we are losing test coverage (while pretending we have it).

Context

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@zharinov zharinov requested review from rarkins and viceice June 18, 2024 00:18
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

🤔 looks like a step back from our tooling best practices. we explicitly want to not mock fs-extra to allow partial real fa reads.

@zharinov
Copy link
Collaborator Author

pipenv <- fs <- fs-extra
          ^^
          Good: mock our own code which we sure works fine
pipenv <- detect-tools <- fs-extra
          ^^^^^^^^^^^^
          Bad: mock the code we never run on production
               and we not sure if it's correct
pipenv <- fs <- fs-extra
                ^^^^^^^^
                This PR: mock the underlying level to make sure
                new external tool behaves similar
pipenv <- detect-tool <- fs-extra
          ^^^^^^^^^^^    ^^^^^^^^
          Next PR: the implementation is replaced,
                   but tests are still working because
                   we target the underlying level

@zharinov zharinov marked this pull request as draft June 20, 2024 16:57
@zharinov zharinov marked this pull request as ready for review June 20, 2024 23:43
@zharinov zharinov requested a review from viceice July 1, 2024 13:36
rarkins
rarkins previously approved these changes Jul 1, 2024
@viceice viceice added this pull request to the merge queue Jul 1, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 1, 2024
@rarkins rarkins added this pull request to the merge queue Jul 1, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 1, 2024
@viceice viceice added the ci:fulltest Run full test suite on all platforms label Jul 1, 2024
@rarkins
Copy link
Collaborator

rarkins commented Jul 1, 2024

@zharinov failures on windows:

    - Expected  - 3
    + Received  + 3

      Array [
        Array [
    -     "/tmp/renovate/cache/others/pipenv",
    +     "D:/tmp/renovate/cache/others/pipenv",
        ],
        Array [
    -     "/tmp/renovate/cache/others/pip",
    +     "D:/tmp/renovate/cache/others/pip",
        ],
        Array [
    -     "/tmp/renovate/cache/others/virtualenvs",
    +     "D:/tmp/renovate/cache/others/virtualenvs",
        ],
      ]

      910 |     ]);
      911 |
    > 912 |     expect(fsExtra.ensureDir.mock.calls).toEqual([
          |                                          ^
      913 |       ['/tmp/renovate/cache/others/pipenv'],
      914 |       ['/tmp/renovate/cache/others/pip'],
      915 |       ['/tmp/renovate/cache/others/virtualenvs'],

rarkins
rarkins previously approved these changes Jul 1, 2024
@zharinov zharinov requested a review from rarkins July 1, 2024 20:53
@rarkins rarkins enabled auto-merge July 2, 2024 04:47
@rarkins rarkins added this pull request to the merge queue Jul 2, 2024
Merged via the queue into renovatebot:main with commit 0a7ce18 Jul 2, 2024
51 checks passed
@rarkins rarkins deleted the refactor/pipenv-artifact-tests branch July 2, 2024 04:53
@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 37.421.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

bryannaegele pushed a commit to bryannaegele/renovate that referenced this pull request Jul 8, 2024
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ci:fulltest Run full test suite on all platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants