// Disposable, locally supplied fixture; no SCM credentials or production checkout. node { stage('Dependencies') { sh 'python3 --version && git --version' } stage('Fresh fixture') { // Delete only this disposable job workspace, inside the test container. deleteDir() sh 'cp -R /opt/ssw590-input/fixtures/. .' if (params.BREAK_CALCULATION) { sh '''python3 - <<'PY' from pathlib import Path p = Path('pricing.py') s = p.read_text() assert s.count('return unit_price * quantity') == 1 p.write_text(s.replace('return unit_price * quantity', 'return unit_price + quantity')) PY''' } sh 'sha256sum pricing.py' } stage('Syntax') { sh 'python3 -m py_compile pricing.py' } stage('Unit tests') { sh 'python3 -m unittest discover -s tests -v' } }