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

Decouple published modules from scalatest #2970

Merged

Conversation

rossabaker
Copy link
Member

This isolates our ScalaTest dependency to tests and docs so we can publish cats-2.0.0 before scalatest-3.1.0 is released.

  • CatsSuite and CatsEquality, which depend on ScalaTest, are moved from cats-testkit to cats-tests' tests. This means we can continue to use them internally, but they are no longer available to external projects.

  • The docs depend on discipline-scalatest for a full example. These examples assume a ScalaTest 3.1.0, which we hope will follow quickly after cats-2.0.0 is published. We can update the docs if there is a breaking change before scalatest-3.1.0.

If there is external demand for CatsSuite, we could consider a separate cats-scalatest repo with its own release cycle.

cats-testkit is no longer directly mentioned in the docs, calling into question its value as a module. That debate is for another PR, but is worth considering before we commit to cats-2.0.0.

@rossabaker rossabaker changed the title Decouple cats-testkit from scalatest Decouple published modules from scalatest Aug 2, 2019
@codecov-io
Copy link

codecov-io commented Aug 2, 2019

Codecov Report

Merging #2970 into master will increase coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2970      +/-   ##
==========================================
+ Coverage   93.93%   93.98%   +0.04%     
==========================================
  Files         371      369       -2     
  Lines        7061     7052       -9     
  Branches      177      178       +1     
==========================================
- Hits         6633     6628       -5     
+ Misses        428      424       -4

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0bab9eb...89587fc. Read the comment docs.

Copy link
Contributor

@kailuowang kailuowang left a comment

Choose a reason for hiding this comment

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

Nice! Thanks!


For most of the type classes included in Cats, the above will work great.
However, the law tests for the type classes inside `cats.kernel` are located in `cats.kernel.laws.discipline.*` instead.
So we have to import from there to test type classes like `Semigroup`, `Monoid`, `Group` or `Semilattice`.

Let's test it out, by defining a `Semigroup` instance for our `Tree` type.
Let's test it out by defining a `Semigroup` instance for our `Tree` type.
Copy link
Member

Choose a reason for hiding this comment

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

Random grammar fixes in the middle of an otherwise pure refactoring will never cease to bemuse and satisfy me.

@djspiewak djspiewak merged commit 92dc596 into typelevel:master Aug 2, 2019
@rossabaker rossabaker deleted the decouple-testkit-from-scalatest branch August 2, 2019 16:20
@kailuowang kailuowang added this to the 2.0.0-RC1 milestone Aug 2, 2019
@ceedubs
Copy link
Contributor

ceedubs commented Aug 14, 2019

I have no strong attachment to CatsSuite (the even method is evidence that it was never really intended for external usage). But CatsEquality is pretty handy for anyone who is using cats and Scalatest. It's small but finicky enough that it seems like it shouldn't be copied into every repo who wants its functionality. It might be useful to expose in a scalatest support module?

Now that I'm typing this out I'm realizing that I should probably just finally make the effort to convert some of my Scalatest tests to use a more lightweight testing library. But lots of people are still going to use Scalatest, and it's not easy for big code bases to transition all at once.

@rossabaker
Copy link
Member Author

I wouldn't object to that being a microlibrary in a separate repo -- and we even could bring back a CatsSuite cleaned up for external use. But publishing that here would again put us and everything downstream at the mercy of ScalaTest's release cycle.

@ceedubs
Copy link
Contributor

ceedubs commented Aug 14, 2019

Ah sorry about that I didn't take the time to fully understand the context. I agree that it doesn't belong in this repo. And it is a small enough amount of code that I would probably copy and paste it as opposed to getting a new repo and build set up 😵

@kailuowang
Copy link
Contributor

kailuowang commented Aug 14, 2019

👍 for creating a Cats-testkit-scalatest repo. Copy pasting code from two files + finding out what extra dependencies are needed is a bit too much for someone trying to figure out how to law testing instances for cats type classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants