Why is module not found only when doing unit testing with pytest? [duplicate]
问题 This question already has answers here : PATH issue with pytest 'ImportError: No module named YadaYadaYada' (19 answers) Closed 4 days ago . I'm having a problem running unit tests. I have a project structure like this: Given this directory who-said-what/ | |_ wave_encoder.py | |_ tests/ |_ test_wave_encoder.py where test_wave_encoder.py looks like this: from wave_encoder import * class TestEncoder(): def test_plot_no_fit1(self): encoder = WaveEncoder() self.assertRaises(ValueError, encoder