[-] sajran@lemmy.ml 4 points 4 months ago

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.ml 4 points 5 months ago

But... How do you even know you can smell ants? Why did you try it? Or can you smell them from meters away?

[-] sajran@lemmy.ml 4 points 5 months ago

Of course, but when indentation has a syntactic meaning the formatter often won't be able to fix it.

[-] sajran@lemmy.ml 4 points 7 months ago

If you install one of the supported apps (e.g. Ecosia) it appears as an option in the menu. I didn't find a way to use FF yet.

[-] sajran@lemmy.ml 4 points 7 months ago

I'm pretty sure I have aphantasia. My mom, on the other hand, is an artist with very powerful imagination. She would often tell me how she sees something she's imagining and I never really knew what she meant. I just assumed that it's kinda a figure of speech. Only when I first read about aphantasia I realized that it probably really works completely differently for her.

I would like to know whether aphantasia has any practical impact on one's life. For example, I had this suspicion that differences in my "mental image processing pipeline" might be a factor in my terrible driving skills. Quick visual assessment of the traffic situation, at an intersection for instance, is very hard for me. This is just me making stuff up though, no idea if it makes any sense. In fact, I think I'm going to research this topic and look for some papers now!

[-] sajran@lemmy.ml 4 points 11 months ago

Nice to know I'm not the only one never remembering how old I am... And I'm only in my 20's. Before I hit 18 I always knew exactly. After 18 it just doesn't matter anymore.

[-] sajran@lemmy.ml 4 points 1 year ago

leap forwards in tech

It's a shitty smartphone without a screen.

[-] sajran@lemmy.ml 3 points 1 year ago

It doesn't. I would really like that too...

[-] sajran@lemmy.ml 3 points 1 year ago* (last edited 1 year ago)

Yeah, I didn't mention this but if it's just impossible to buy something then I don't see anything wrong about piracy. No one looses anything.

[-] sajran@lemmy.ml 3 points 1 year ago

Yup, IMO Python is so much better with type hints that I can't help but think they should just be part of the language. Which is kinda stupid because of the "original philosophy" as you said. But on the other hand things like third party static type checkers and type stubs, or just untyped libraries can be a real PITA .

Also, I acknowledge that the lack of typing can be an advantage for some people in some circumstances, even though I use typing even in the simplest and shortest scripts myself. Why would I want to figure out the types every time I look at the function if I can just write it down?

[-] sajran@lemmy.ml 4 points 1 year ago

Agreed. Considering how much I use YT, and how much high quality content I find there, the price for premium is incredibly low. I would definitely pay multiple of it if I had to (maybe I shouldn't give them ideas though...).

[-] sajran@lemmy.ml 3 points 1 year ago

I hate shorts and I hate seeing them in my subscription feed.

view more: ‹ prev next ›

sajran

joined 1 year ago