Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 10 23:03
    scala-steward opened #259
  • Apr 10 21:08

    Baccata on make-prop-implicit-work-with-zio

    (compare)

  • Apr 10 21:08

    Baccata on master

    Fix Prop implicit instance for … Update the readme (compare)

  • Apr 10 21:08
    Baccata closed #258
  • Apr 10 21:08
    Baccata closed #257
  • Apr 10 21:08
    Baccata closed #255
  • Apr 10 18:25
    Baccata edited #258
  • Apr 10 18:24
    Baccata opened #258
  • Apr 10 18:23

    Baccata on make-prop-implicit-work-with-zio

    Fix Prop implicit instance for … Update the readme (compare)

  • Apr 08 16:48

    Baccata on remote-cache-ci

    (compare)

  • Apr 08 16:48

    Baccata on master

    Cached compilation on CI (#256)… (compare)

  • Apr 08 16:48
    Baccata closed #256
  • Apr 08 16:48
    Baccata closed #251
  • Apr 08 12:16
    Baccata commented #257
  • Apr 08 12:12
    LLCampos opened #257
  • Apr 08 06:56
    keynmol edited #256
  • Apr 08 06:55
    keynmol synchronize #256
  • Apr 08 06:55

    keynmol on remote-cache-ci

    Remove dummy publishing job (compare)

  • Apr 07 19:06
    keynmol synchronize #256
  • Apr 07 19:06

    keynmol on remote-cache-ci

    try to simplify build (compare)

Gabriel Volpe
@gvolpe:matrix.org
[m]
Right, awesome, this'll do for now :)
Anton Sviridov
@velvetbaldmime:matrix.org
[m]

Also - I've mentioned your message on the issue that Jakub created: https://github.com/disneystreaming/weaver-test/issues/187#issuecomment-789071232

Given the size of your initial integration, it's wholly possible that someone can create a separate artifact (under typelevel or other org) for this exact thing. It's a bit gratuitous for 14 lines, but I understand how convenient it is :)

Gabriel Volpe
@gvolpe:matrix.org
[m]
Cool, I'll definitely migrate over some artifact if there's one :) We did the same with the discipline-munit integration some time ago
Gabriel Volpe
@gvolpe:matrix.org
[m]
I'm in the middle of the migration and there are a few tests using cats.effect.laws.util.TestContext. Is there a replacement to deal with time-passing (that would be incredibly amazing!) or a workaround to integrate it with TestContext (I never liked this one)? It seems I cannot override both the ContextShift[IO] and Timer[IO] instances because they are marked as final in BaseIOSuite.
No rush, anyway, I've done enough for the day, time to go and grab a beer 🍺
Gabriel Volpe
@gvolpe:matrix.org
[m]
Have you discussed support for IO.sleep sometime in the past? Probably coupled to the internals of IO I'd believe
Anton Sviridov
@velvetbaldmime:matrix.org
[m]

With regard to TestContext - there's no direct support because the suites have the default CS/Timer imported, so that all of the IO tasks are executed on the same runtime.

It's down to implicit resolution - I think if you put implicit val tc = TestContext() in the suite itself, it should shadow the one brought in by extending SimpleIOSuite?

With regards to IO.sleep - I think that's the same thing as with TestContext's timer - you can build an IO that uses those special CS/Timer and then in the test itself you can run that IO and assert on it I guess.

I'm not that familiar with cats-effect-testkit so not sure what would a better integration look like :)

Gabriel Volpe
@gvolpe:matrix.org
[m]
Thanks Anton :) I'll give it a try, for now I'm blocked on this one
I think zio-test supports dealing with sleeps out of the box, that's a really nice feature
Olivier Mélois
@Baccata

@gvolpe:matrix.org Anton's right, the implicit resolver will not freak out at the duplication as long as you use the same name :

locally {
    implicit val int : Int = 1
    locally {
      implicit val int : Int = 2
      println(implicitly[Int])
    }
  }

compiles and prints 2

Olivier Mélois
@Baccata
Also, you cannot override the timer directly, but you can override the "UnsafeRun" instance which is our abstraction that acts as a shim to support both CE2 and CE3. In CE2, the UnsafeRun defines the timer that is then exposed in the suite
Gabriel Volpe
@gvolpe:matrix.org
[m]
Thanks @Baccata , unfortunately I had to back off with the migration. Our project is quite big and the execution times were multiplied 5 times more or less.
Have you discussed at some point support for time-passing tests? I think that would be a great addition and that's what's currently missing in most testing frameworks. TestContext is a horrible hack IMO.
Olivier Mélois
@Baccata

Have you discussed at some point support for time-passing tests? I think that would be a great addition and that's what's currently missing in most testing frameworks. TestContext is a horrible hack IMO.

@gvolpe:matrix.org not yet, the reason being our primary concern it to cater to I/O heavy integration tests, and that making life easier for unit tests is not so much a priority I'm afraid (that's why we parallelise by default, which might partially explain why execution times wouldn't be great if you're using weaver for unit-testing and haven't set parallelism to 1). Moreover, the incoming churn in the ecosystem makes the incorporation of new features tricky

Olivier Mélois
@Baccata
That being said, what UX would you expect to have ?
Gabriel Volpe
@gvolpe:matrix.org
[m]
@Baccata: thanks for the heads up! To be honest, I haven't thought about it much but maybe something similar to what TestContext allows us to do (e.g. ec.tick(5.seconds) to manually forward time) but in a purely functional way, not via unsafeToFuture or so :)
Gabriel Volpe
@gvolpe:matrix.org
[m]
Got started with the testing chapter :) https://i.imgur.com/HWU96cA.png
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
haha :D
ybasket
@ybasket:matrix.org
[m]
Hey folks, thanks a lot for weaver, I love the resource sharing and logging!
As I'm currently trying to persuade my colleagues to swap MUnit for weaver, it would be super-cool if you could release the InteliiJ plugin for the current EAP versions (211.x). The current version of the plugin can't be loaded because it specifies 203.x as both the min and the max version of IntelliJ…maybe the version cap could just be removed?
I can help with that one if nobody has time, but as it would take me weeks to get to it, I'd appreciate a lot if someone had the setup and could "just do it" 😉
Olivier Mélois
@Baccata

@ybasket, hey, thanks for the praise :)

regarding Intellij, we're currently hoping to remove the plugin altogether in favour of a Junit runner that Intellij would pick up natively (maintaining the plugin is a PITA for various reasons, and bumping the max version might not "just work"). I've moved the sources of the intellij plugin
there a few months ago. I'm currently off work but when I come back next week I'll try to find the time to at least write instructions on how to build / install from disk

regarding MUnit, note that you don't have to "jump", the two frameworks can colocate and SBT will know how to use both at the same time :) The two are catering to slightly different usecases : unit testing pure functions with munit is much faster than with weaver because it has less overhead. Weaver is great for testing effectful code and deployed applications

ybasket
@ybasket:matrix.org
[m]

@Baccata Well deserved!

On IntelliJ: That sounds like a good plan with JUnit. If it doesn't work out, there might still be the option to contribute it directly to the IntelliJ Scala plugin – I've done it twice (context-applied & newtypes), they accepted both. My current problem is kinda solved as I was able to compile a working version of the plugin yesterday rather quickly, now I just have to distribute this zip file among my colleagues.

On MUnit: I'm aware of the time penalty weaver has and considered having both, but our codebases are small enough to ignore a few milliseconds and avoid the (mental) overhead of having both. But thank you for the hint!

Anton Sviridov
@velvetbaldmime:matrix.org
[m]

Hey everyone! We've just published new releases of weaver:

If you're using Cats Effect 2, use 0.6.0-M7
If you're using Cats Effect 3, use 0.7.0-M7

The Main thing is finally switching to stable releases of Cats ffect 3 and fs2 3

There's also a small bugfix in global shared resources.

This paves the way to stabilising 0.6.0 and 0.7.0 very soon :) Hope you enjoy and let us know if there are any issues

Gabriel Volpe
@gvolpe:matrix.org
[m]

Hey folks! 👋

May I ask for your opinion about this implementation? https://github.com/gvolpe/pfps-shopping-cart/blob/second-edition/modules/tests/src/main/scala/suite/ResourceSuite.scala

The idea is to primarily support beforeAll and afterAll, but also to provide a way to migrate tests that use beforeEach, afterEach or beforeAndAfterEach :)

Olivier Mélois
@Baccata

I'd use guarantee here instead of <*(if I read your code correctly the afterAll is guaranteed but not the afterEach)

Just looking at it, I'm not sure whether the afterAll is sound, it looks like it could be hanging forever (but I assume you've tried it and it doesn't). Is there anything wrong with just :

def afterAll(f: Res => IO[Unit]) = res.flatMap(r => Resource.make(IO.unit)(_ => f(res)))

?

Gabriel Volpe
@gvolpe:matrix.org
[m]
Thanks @Baccata , good point about guarantee, I forgot that the expected IO[Expectations] can also raise errors
How would you use that afterAll in a test suite? Not very clear to me by looking at it
Though, if I understand correctly, that would be more a beforeAll, no? As the second resource would be evaluated - and f(res) would run - before any of the tests are executed.
Olivier Mélois
@Baccata
oops my bad. It'd be a flatTap actually.

Though, if I understand correctly, that would be more a beforeAll, no?

No the f is called in the finaliser of the inner resource

so after the tests are run
Gabriel Volpe
@gvolpe:matrix.org
[m]
you're right, that's much simpler!
Olivier Mélois
@Baccata
:+1:
Gabriel Volpe
@gvolpe:matrix.org
[m]
I'll give it a try now
the other implementation works, though, it does not hang forever, I tried that :D
Olivier Mélois
@Baccata
haha good :smile:
Gabriel Volpe
@gvolpe:matrix.org
[m]
works like a charm! feel silly now that I look at it, seems so obvious 😄
@Baccata: I'm getting closer to have something presentable for the 2nd edition, would you be interested in giving it a read? At least just Chapter 8, which is all about testing and mainly about Weaver
Gabriel Volpe
@gvolpe:matrix.org
[m]
Anton Sviridov: you too if interested, I think we briefly talked about it last time :)
Will just need your email to send you the first draft as soon as I have it: mine is hello at gvolpe dot com
Olivier Mélois
@Baccata
@gvolpe:matrix.org sure :) I've pinged you via email
Gabriel Volpe
@gvolpe:matrix.org
[m]
@Baccata: thanks, got your email :)
Olivier Mélois
@Baccata
Hey all, we've just released 0.6.0 / 0.7.0. Have fun :smile:
Fernando Mora
@fernandomora

mmm, maybe I'm doing something wrong, but after upgrading to 0.6.0 I can't import SimpleIOSuite anymore:

object SimpleIOSuite is not a member of package weaver
[error] import weaver.SimpleIOSuite

It seems the package object that defines those aliases https://github.com/disneystreaming/weaver-test/blob/master/modules/core/cats/src/weaver/package.scala is not in weaver-core_2.13-0.6.0.jar anymore

Do I need to add some new dependency?

Olivier Mélois
@Baccata
@fernandomora yes indeed. Weaver is now effect specific, so you'll have to follow these new instructions : https://disneystreaming.github.io/weaver-test/docs/cats
apologies for the inconvenience
Fernando Mora
@fernandomora
Ahhh, right! Sorry for not founding it before :grimacing: :+1:
Olivier Mélois
@Baccata
no worries, we know it'll trip people up
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
If we had the ability to deprecate stuff in sbt - we would :D but alas