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

Port Boopickle to cats effect 3 and add basic munit infrastructure #3852

Merged
merged 1 commit into from Nov 19, 2020

Conversation

cquiroz
Copy link
Member

@cquiroz cquiroz commented Nov 13, 2020

This PR ports boopickle to run on CE3 but perhaps more important it lays the basics to use
munit/munit-cats-effect for tests.

There is still some work to do but I wanted to verify if the idea of munit seems workable

}

checkAll("EntityCodec[IO, Fruit]", EntityCodecTests[IO, Fruit].entityCodec)
// checkAll("EntityCodec[IO, Fruit]", EntityCodecTests[IO, Fruit].entityCodec)
Copy link
Member Author

Choose a reason for hiding this comment

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

EntityCodecTests needs a rewrite to run on munit-cats-effect, if you think munit is fine I could try to do the rewrite

Copy link
Member

Choose a reason for hiding this comment

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

Why does it need a rewrite? I think it's based just on Discipline?

I'm for what makes it work. I just haven't studied it enough to understand.

Copy link
Member Author

Choose a reason for hiding this comment

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

The particular laws take an Eq[IO[A]] which we don't have right now


/** Common stack for http4s' munit based tests
*/
trait Http4sSuite
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 equivalent to Http4sSpec for munit. It will need to grow as needed

build.sbt Outdated
.enablePlugins(PrivateProjectPlugin)
.settings(
// Root project
name := "http4s",
description := "A minimal, Scala-idiomatic library for HTTP",
description := "A minimal, Scala-idiomatic library for HTTP"
Copy link
Member

Choose a reason for hiding this comment

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

You don't like my trailing commas? 😆

Copy link
Member Author

Choose a reason for hiding this comment

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

I think they were removed by scalafmt; I can restore them

Copy link
Member

Choose a reason for hiding this comment

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

I'm maintaining four branches right now, so I'm just a little bit frantic about unnecessary diffs right now, especially when they're on the furthest branch downhill.

}

checkAll("EntityCodec[IO, Fruit]", EntityCodecTests[IO, Fruit].entityCodec)
// checkAll("EntityCodec[IO, Fruit]", EntityCodecTests[IO, Fruit].entityCodec)
Copy link
Member

Choose a reason for hiding this comment

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

Why does it need a rewrite? I think it's based just on Discipline?

I'm for what makes it work. I just haven't studied it enough to understand.

test("decode a class from a boopickle decoder") {
val result = booOf[IO, Fruit]
.decode(Request[IO]().withEntity(Banana(10.0): Fruit), strict = true)
result.value.map(assertEquals(_, Right(Banana(10.0))))
Copy link
Member

Choose a reason for hiding this comment

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

I love the removal of an unafeRunSync(). ❤️

with syntax.AllSyntax
with ArbitraryInstances
Copy link
Member

Choose a reason for hiding this comment

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

In Cats, it was discussed to not extend syntax traits or arbitraries in the base test suite, so as to make the tests look more like the kind of code it would be testing. We will have a few more imports in our tests without these two lines, but I think it might be better, and this is our chance at a fresh start. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll remove everything we don't need right away.

@rossabaker rossabaker added this to To do in Cats Effect 3 via automation Nov 13, 2020
@rossabaker rossabaker moved this from To do to In Progress in Cats Effect 3 Nov 13, 2020
@rossabaker
Copy link
Member

Also, if this works, we should consider backporting the munit infrastructure to series/0.21. Keeping those branches aligned as much as possible works strongly to our benefit while we're finishing up 1.0.

),
unusedCompileDependenciesFilter -= moduleFilter(organization = "org.typelevel", name = "discipline-munit"),
Copy link
Member Author

Choose a reason for hiding this comment

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

I need this to pass CI but I'm not sure why, we are using classes from both libs

@cquiroz
Copy link
Member Author

cquiroz commented Nov 19, 2020

Maybe we can merge this with the law check commented while we figure out how to check effectful laws with discipline and munit

Copy link
Member

@rossabaker rossabaker left a comment

Choose a reason for hiding this comment

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

That works for me.

If we're integrating munit, I'd like to bring back the munit infrastructure to series/0.21, so it rolls downhill. I can take care of that, unless you want to.

@cquiroz
Copy link
Member Author

cquiroz commented Nov 19, 2020

I can do it, I'll rebase this and merge it

@cquiroz cquiroz force-pushed the boopickle branch 3 times, most recently from 0529ec9 to cf4d0a6 Compare November 19, 2020 12:15
Signed-off-by: Carlos Quiroz <carlos.m.quiroz@gmail.com>
@cquiroz
Copy link
Member Author

cquiroz commented Nov 19, 2020

Ok I squashed this and I will merge to move on to others, The doc task is not yet building

@cquiroz cquiroz merged commit 8aef0c6 into http4s:cats-effect-3 Nov 19, 2020
Cats Effect 3 automation moved this from In Progress to Done Nov 19, 2020
@cquiroz cquiroz deleted the boopickle branch November 19, 2020 14:53
rossabaker pushed a commit to http4s/http4s-servlet that referenced this pull request Apr 3, 2022
Port Boopickle to cats effect 3 and add basic munit infrastructure
armanbilge pushed a commit to http4s/http4s-boopickle that referenced this pull request May 2, 2022
Port Boopickle to cats effect 3 and add basic munit infrastructure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants