implement: Validate question JSON before export (t8) #309
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11'] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade setuptools wheel | |
| pip install poetry | |
| poetry config virtualenvs.create true | |
| poetry install --with dev --all-extras | |
| - name: Install Pandoc # apt version seems too old | |
| uses: r-lib/actions/setup-pandoc@v2 | |
| - name: Linting Checks | |
| run: | | |
| poetry run black --check . | |
| poetry run isort --check-only in2lambda docs tests | |
| poetry run pydocstyle --convention=google in2lambda tests | |
| - name: pytest | |
| run: poetry run pytest --cov-report=xml:coverage.xml --cov=in2lambda | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| # The build job always has panflute and pandoc; this proves the library works without them. | |
| library-only: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install without extras | |
| run: pip install . | |
| - name: Author a set | |
| working-directory: ${{ runner.temp }} | |
| run: | | |
| python -c " | |
| import tempfile | |
| from in2lambda.api.set import Set | |
| s = Set() | |
| s.add_question('Q', 'text') | |
| s.current_question.add_part_text('part a') | |
| s.current_question.add_solution('solution a') | |
| s.to_json(tempfile.mkdtemp()) | |
| " | |
| in2lambda --help |