Python Forum
pytest in CircleCI filepath error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pytest in CircleCI filepath error
#1
I'm trying to implement continuous integration unit test with circleCI and pytest. I think I have everything setup properly at this point, and I can run the unit tests locally with the command python -m pytest.

But when I do that through circleCI I get:

_____________________ ERROR collecting test/test_sample.py _____________________
Error:
import file mismatch: imported module 'test_sample' has this __file__ attribute: /home/circleci/Active-Learning/src/active-learning/test/test_sample.py which is not the same as the test file we want to collect: /home/circleci/Active-Learning/test/test_sample.py HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
My project structure is:

/Active-Learning/
--src/
----source.py
--test/
----test_sample.py

I don't have any pyc files as far as I can see. So I'm not sure what is going on.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pytest Installed, but VS Code Won’t Access Pytest AstralWeeks 9 3,319 Sep-13-2023, 03:00 PM
Last Post: AstralWeeks
  Pytest mocks anthonyrmoss78 0 453 May-30-2023, 08:28 PM
Last Post: anthonyrmoss78
  How to concatenate filepath with variable? Mark17 2 5,572 Jan-31-2022, 09:13 PM
Last Post: Mark17
  Output CSV file with filepath and file contents glittergirl 1 1,753 Aug-03-2020, 01:50 AM
Last Post: glittergirl
  Trying to pass an exe filepath to tkinter Chatbot & expecting the chatbot to run it svkroy 0 1,590 Jul-16-2020, 07:46 AM
Last Post: svkroy
  Pytest and rootdirectory Master_Sergius 4 4,691 Jun-01-2020, 05:05 PM
Last Post: Master_Sergius
  Pytest with requests a21250450 3 2,775 Mar-21-2019, 03:24 PM
Last Post: buran
  Running pytest gives " 'cannot import name 'session' " error jasonblais 2 3,632 Oct-10-2018, 05:02 PM
Last Post: jasonblais
  pytest fixture in conftest.py thrown error while in the test file runs OzzieOzzum 1 3,981 Jul-31-2018, 12:12 PM
Last Post: OzzieOzzum
  pytest and caplog lazyliv 0 3,080 May-16-2018, 02:36 PM
Last Post: lazyliv

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020