Super newbie question - I have a couple of files in the tests project folder - tests/setA/testSetA.py. How do I specify these input files required by my Python script, in the circleci configuration file?
Here’s the configuration file I have at the moment.
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
- image: circleci/python:3.6.1
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
working_directory: ~/repo
steps:
- checkout
- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements/requirements.txt
# run tests!
- run:
name: run tests
command: |
. venv/bin/activate
python3 tests/setA/testSetA.py
# - store_artifacts:
# path: test-reports
# destination: test-reports
Hi, Thanks for getting back. The ‘run tests’ phase of the build fails with the below error message:
#!/bin/bash -eo pipefail
. venv/bin/activate
python3 tests/setA/testSetA.py
process: [Errno 2] No such file or directory: ‘Table1.csv’
Exited with code 255
Here is the folder structure of my Python project:
OK. So, your Python code testSetA.py or a file that calls needs to find a file called Table1.csv. How is that file referenced? May we see the relevant bit of Python code?
(I appreciate you’re a beginner, but if you can learn from my counter-questions, that would be awesome. If you get an error, always put that in the first post, and if your error comes from a piece of code, then show that code as well. That would’ve saved two replies from me, and two replies from you, meaning you get your answer faster!)
Edit
You read my mind - you added the dir structure already. Nice one!
Awesome, what was the answer? I was going to suggest ~repo/tests/setA/Table1.csv, as I don’t know how Python works in terms of relative directory references.