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 26,479 Sep-13-2023, 03:00 PM
Last Post: AstralWeeks
  Pytest mocks anthonyrmoss78 0 1,310 May-30-2023, 08:28 PM
Last Post: anthonyrmoss78
  How to concatenate filepath with variable? Mark17 2 11,832 Jan-31-2022, 09:13 PM
Last Post: Mark17
  How to run a pytest test for each item in a list arielma 0 3,667 Jan-06-2021, 10:40 PM
Last Post: arielma
  capture pytest results to a file maiya 2 8,650 Oct-17-2020, 03:42 AM
Last Post: maiya
  Output CSV file with filepath and file contents glittergirl 1 2,979 Aug-03-2020, 01:50 AM
Last Post: glittergirl
  pytest, parametrize, neasted list niski1996 0 2,566 Jul-21-2020, 10:36 PM
Last Post: niski1996
  Trying to pass an exe filepath to tkinter Chatbot & expecting the chatbot to run it svkroy 0 2,467 Jul-16-2020, 07:46 AM
Last Post: svkroy
  Pytest and rootdirectory Master_Sergius 4 8,751 Jun-01-2020, 05:05 PM
Last Post: Master_Sergius
  pytest-html report customize manoj 4 17,772 Nov-26-2019, 09:10 AM
Last Post: manojshetty

Forum Jump:

User Panel Messages

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