0
0
PyTesttesting~10 mins

Running PyTest in GitHub Actions - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the name of the GitHub Actions workflow.

PyTest
name: [1]
Drag options to blanks, or click blank then click option'
ARun PyTest
BTest Workflow
CCI Pipeline
DPyTest Runner
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving the name empty or using unclear names.
Using special characters that might cause YAML errors.
2fill in blank
medium

Complete the code to specify the event that triggers the workflow on every push.

PyTest
on: [1]
Drag options to blanks, or click blank then click option'
Apush
Bpull_request
Crelease
Dschedule
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pull_request' when you want to run on push.
Using 'schedule' which runs on a timer, not on push.
3fill in blank
hard

Fix the error in the job definition to specify the runner environment.

PyTest
jobs:
  test:
    runs-on: [1]
Drag options to blanks, or click blank then click option'
Awindows-latest
Bdocker-latest
Cmacos-latest
Dubuntu-latest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'docker-latest' which is not a valid runner label.
Choosing Windows or macOS runners unnecessarily.
4fill in blank
hard

Fill both blanks to install Python and dependencies before running tests.

PyTest
steps:
  - uses: actions/checkout@v3
  - name: Set up Python
    uses: [1]@v4
    with:
      python-version: [2]
Drag options to blanks, or click blank then click option'
Aactions/setup-python
B3.12
Cactions/setup-node
D2.7
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'actions/setup-node' instead of Python setup.
Specifying an outdated Python version like 2.7.
5fill in blank
hard

Fill all three blanks to run PyTest and save test results.

PyTest
  - name: Install dependencies
    run: pip install -r [1]
  - name: Run tests
    run: [2] --junitxml=[3]
Drag options to blanks, or click blank then click option'
Arequirements.txt
Bpytest
Ctest-results.xml
Dsetup.py
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'setup.py' instead of 'requirements.txt' for dependencies.
Forgetting to specify the test results file.