Skip to content

Commit

Permalink
Validate python path for pytest is not empty as well (#7)
Browse files Browse the repository at this point in the history
* Validate python path for pytest is not empty as well

* Update ci.yml

* Update ci.yml

* Update ci.yml
  • Loading branch information
sfc-gh-osalazarlizano authored Jun 19, 2024
1 parent eaf35b3 commit 9693c6f
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,24 @@ jobs:
.filter(x => x.length > 0 && !x.startsWith('.')));
const pytestPaths = new Set()
const pytestArgs = new Set()
for (const rootPath of paths)
{
getPytestPaths(rootPath, x => pytestPaths.add(x))
{
let subFoldersWithPythonFiles = 0;
getPytestPaths(rootPath, x =>
{
pytestPaths.add(x);
subFoldersWithPythonFiles++
})
if (subFoldersWithPythonFiles > 0)
{
pytestArgs.add(rootPath)
}
}
core.setOutput('pytestPaths', [...pytestPaths].join(' '));
core.setOutput('pytestArgs', [...paths].join(' '));
core.setOutput('pytestArgs', [...pytestArgs].join(' '));
- name: Setup test environment
uses: conda-incubator/setup-miniconda@v2
Expand All @@ -94,7 +105,8 @@ jobs:
- name: Run tests
run: |
args=${{ steps.tests_to_run.outputs.pytestArgs }}
if [ -z "${args}" ]; then
pythonpath=${{ steps.tests_to_run.outputs.pytestPaths }}
if [ -z "${args}" ] || [ -z "${pythonpath}" ]; then
echo “Nothing to test”
else
pytest $args
Expand Down

0 comments on commit 9693c6f

Please sign in to comment.