• 1 Post
  • 31 Comments
Joined 1 year ago
cake
Cake day: June 21st, 2023

help-circle
  • Since you have all your shutil.copytrees and sys.path manipulation at the top level of the test modules, they are executed the moment those modules are imported. unittest likely imports all discovered test modules before actually executing the tests so the set up of both modules is executed in random order before the tests are run. The correct way to perform test setup is using setUp and setUpClass methods of unittest.TestCase. Their counterparts tearDown and tearDownClass are used to clean up after tests. You probably will be able to get this to work somehow using those methods.

    However, I’m fairly certain that this entire question is an example of the XY problem and you should be approaching this whole thing differently. Copying the modules and their mock dependencies into a temporary directory and manipulating sys.path seems like an absolute nightmare and it will be a massive PITA even if you get it to a working state. I don’t know what problem exactly you’re trying to solve but I think you should really read up on unittest.mock and even more importantly on dependency injection.



















  • sajran@lemmy.mltoLemmy Shitpost@lemmy.worldThe golden years
    link
    fedilink
    arrow-up
    36
    arrow-down
    3
    ·
    11 months ago

    I heard this opinion many times and I couldn’t disagree more. I hated school and I much prefer my adult, working life. In fact I feel like my life only gets better as time goes by.

    Granted, I’m privileged to have a well paying job I actually enjoy, which probably makes a world of a difference.



  • Apple just loves to make their stuff seem special by giving it names. Those names are often ridiculous but somehow it looks like they get the job done. I mean come on, dynamic island? I cringe every time I hear that name.

    But on the other hand take a look at the chip names. While their competitors use chips like “something mtux64-828qwerty”, Apple releases a new A15 ✨bionic✨ which sounds like something that will literally change the world. I mean, it’s bionic, that has to be incredible, right?