Oct-22-2020, 12:00 PM
I have a Jenkinsfile with the below code in one of the stages:
sh """ python funcs/echo/tests/test.py || true coverage xml funcs/echo/tests/test.py || true """My folder structure is:
Output:|-- funcs
| |-- echo
| | |-- app.py
| | `-- tests
| | `-- test.py
| |-- moshe
| | |-- app.py
| | `-- tests
| | `-- test.py
| `-- sum
| |-- app.py
| `-- tests
| `-- test.py
`-- tests
|-- echo
| `-- tests
|-- moshe
| `-- tests
`-- sum
`-- tests
How can I loop using python3 thought the funcs folder? I tired to run the below:my_path="funcs" for dirs in os.walk (my_path): print (dirs)but it return the below:
Output:funcs
funcs/moshe
funcs/moshe/tests
funcs/echo
funcs/echo/tests
funcs/sum
funcs/sum/tests
but what I really need is to loop on those:Output:funcs/moshe/tests
funcs/echo/tetss
funcs/sum/tests
and then for each one copy the 2 output files to the target I described above