strawberry icon indicating copy to clipboard operation
strawberry copied to clipboard

fix: ignored test changed, annotation magic string removed

Open wimble3 opened this issue 5 months ago • 2 comments

Description

Before that fix tests runs with ignored pytest status. I fixed that small bug, also i changed magic strings in StrawberryAnnotation constructor, because its able to input object | str, so i think object is better.

Types of Changes

  • [ ] Core
  • [x] Bugfix
  • [ ] New feature
  • [ ] Enhancement/optimization
  • [ ] Documentation

Issues Fixed or Closed by This PR

No issues

Checklist

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • [x] I have tested the changes and verified that they work and don't break anything (as well as I can manage).

Summary by Sourcery

Fix the forward reference resolution tests to use the actual class object for StrawberryAnnotation instead of strings, preventing them from being ignored by pytest

Bug Fixes:

  • Ensure forward reference tests run correctly by correcting StrawberryAnnotation instantiation

Tests:

  • Use class objects rather than magic strings in test_forward_references to resolve annotations

wimble3 avatar Jun 18 '25 03:06 wimble3

Reviewer's Guide

Updated forward reference tests to pass actual class objects to StrawberryAnnotation and adjusted namespace setup, resolving pytest detection issues and ensuring proper test execution.

File-Level Changes

Change Details Files
Replaced string-based annotations with direct class references in forward reference tests
  • Removed StrawberryAnnotation("ForwardClass", namespace=globals()) before class definition
  • Replaced with StrawberryAnnotation(ForwardClass, namespace=globals()) after class definition
  • Removed string annotation in BackwardClass test
  • Replaced with StrawberryAnnotation(BackwardClass, namespace=namespace)
tests/types/resolving/test_forward_references.py
Adjusted namespace assembly placement for local/global resolution
  • Moved namespace = {**locals(), **globals()} to after BackwardClass definition
  • Ensured namespace variable is passed to StrawberryAnnotation constructor
tests/types/resolving/test_forward_references.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Jun 18 '25 03:06 sourcery-ai[bot]

@wimble3 👋 can you show me how the test was previously ignored? 😊

patrick91 avatar Jun 18 '25 09:06 patrick91

Hello, @patrick91 After your message I checked this again, so... my bad, all works normally Let's agree that it was a magnetic storm?🙄

wimble3 avatar Jun 19 '25 05:06 wimble3

@wimble3 ahaha no worries!

patrick91 avatar Jun 19 '25 07:06 patrick91