Skip to content

Commit fe08748

Browse files
committed
build: prepare to unit test
Adopt Technologies: * PDM - "A modern Python package and dependency manager supporting the latest PEP standards." * pyproject.toml - Used by PDM to manage project dependencies and metadata. * pytest - A nice modern unit testing framework for python. Reorganized tests, and removed local-min-max test. They were breaking and are VERY slow. They were intended to mimic those that run in CI. But those are passing. Added bin/test/units.bash to run unit tests. Place unit tests in tests/unit/. No longer supporting python < 3.9. --- Related to #119 Closes #131 Thanks to Co-authored-by: Akshar Patel <[email protected]> He performed the initial research for pyproject.toml
1 parent e4b429a commit fe08748

24 files changed

+153
-72
lines changed

.github/workflows/test_python-3.5.10_Java-11.0.21-tem.yaml .github/workflows/test_python-3.9.19_Java-11.0.21-tem.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
name: test_python-3.5.10_Java-11.0.21-tem
2+
name: test_python-3.9.19_Java-11.0.21-tem
33

44
on:
55
pull_request:
66

77
jobs:
88
build:
9-
name: test_python-3.5.10_Java-11.0.21-tem
9+
name: test_python-3.9.19_Java-11.0.21-tem
1010
runs-on: ubuntu-latest
1111
steps:
1212
-
@@ -22,7 +22,7 @@ jobs:
2222
push: false
2323
build-args: |
2424
JAVA_VERSION=11.0.21-tem
25-
PYTHON_VERSION=3.5.10
25+
PYTHON_VERSION=3.9.19
2626
-
2727
name: Test
2828
uses: addnab/docker-run-action@v3

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# See https://pdm-project.org/latest/usage/project/#working-with-version-control
2+
.pdm-python
3+
14
# This is created by bin/test/languages.bash. But should not be committed.
25
languages/
36

.gitpod.yml

+5
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,9 @@ tasks:
3232
&& sudo ./install.sh /usr/local \
3333
&& cd .. \
3434
&& sudo rm -rf bats-core
35+
echo ""
36+
echo "INSTALLING PDM"
37+
curl -sSL https://pdm-project.org/install-pdm.py | python3 -
38+
echo "export PATH=/workspace/.pyenv_mirror/user/current/bin:\$PATH" >> ~/.bashrc
3539
exec bash
40+
pdm install

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Related repositories:
1313

1414
- [ourPLCC/languages](https://github.com/ourPLCC/languages): Languages implemented in PLCC.
1515
- [ourPLCC/course](https://github.com/ourPLCC/course): Course materials for
16-
teaching a Programming Languages course that uses PLCC.
16+
teaching a Programming Languages course the uses PLCC.
1717

1818
## Options for Installation and Use
1919

@@ -24,7 +24,7 @@ may help you determine which option is best for you and your class.
2424
| ------ | ------------------- | ----------------------- | ---------- |
2525
| GitPod | Web Browser | * Account on GitPod <br> * Account on hosting service (GitLab/GitHub/Bitbucket) <br> * Knowledge of above and Git | Yes |
2626
| Docker | Docker Desktop | Minimal understanding of Docker | Yes |
27-
| Native | * Bash/Linux-like environment <br> * Java >= 11 <br> * Python >= 3.5 | System administration knowledge | No |
27+
| Native | * Bash/Linux-like environment <br> * Java >= 11 <br> * Python >= 3.9 | System administration knowledge | No |
2828

2929
The advantages of GitPod or Docker are (1) few or no software dependencies
3030
and (2) the ability to provide your class/developers a consistent development
@@ -141,7 +141,7 @@ and use it to install Java.
141141
142142
### Install Python
143143
144-
Check if you have Python >= 3.5
144+
Check if you have Python >= 3.9
145145
146146
```bash
147147
python3 --version

bin/test/units.bash

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
6+
PROJECT_ROOT="$( cd "${SCRIPT_DIR}/../.." &> /dev/null && pwd )"
7+
8+
pdm install
9+
pdm test

pdm.lock

+96
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[project]
2+
name = "plcc"
3+
version = "8.0.0"
4+
description = "Programming Languages Compiler Compiler"
5+
authors = [
6+
{name = "Tim Fossum", email = "[email protected]"},
7+
{name = "Stoney Jackson", email = "[email protected]"}
8+
]
9+
dependencies = []
10+
requires-python = ">=3.9"
11+
readme = "README.md"
12+
license = {text = "GPL-3.0-or-later"}
13+
14+
15+
[project.scripts]
16+
plcc = "plcc.__main__:main"
17+
18+
19+
[build-system]
20+
requires = ["pdm-backend"]
21+
build-backend = "pdm.backend"
22+
23+
24+
[tool.pdm]
25+
distribution = true
26+
27+
28+
[tool.pdm.dev-dependencies]
29+
dev = [
30+
"pytest>=8.2.0",
31+
]
32+
33+
[tool.pdm.scripts]
34+
test = "pytest"

tests/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/local-min-max-test/README.md

-25
This file was deleted.

tests/local-min-max-test/run.bash

-41
This file was deleted.

tests/unit/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)