aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martínez <jjm@usebox.net>2022-02-16 07:33:56 +0000
committerJuan J. Martínez <jjm@usebox.net>2022-02-16 07:33:56 +0000
commitb81f983e882ae947cc23f0bd074af36dca93f57e (patch)
tree2d17ccb4bad3c551208c46679134275fdfe5a0e2
parent31418a90da67a1bcd1af0a39f33e8ecc5cdd2d49 (diff)
downloadubox-msx-lib-b81f983e882ae947cc23f0bd074af36dca93f57e.tar.gz
ubox-msx-lib-b81f983e882ae947cc23f0bd074af36dca93f57e.zip
Add black to CI
-rw-r--r--.gitlab-ci.yml15
-rw-r--r--README.md9
-rwxr-xr-xtests/test_rom.py5
3 files changed, 25 insertions, 4 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0bd0a44..03f9482 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,18 @@
image: registry.gitlab.com/reidrac/ubox-msx-lib-ci:latest
-build-and-test:
+stages:
+ - lint
+ - build
+ - test
+
+lint:
+ script:
+ - black --check --diff .
+
+build:
+ script:
+ - make game
+
+test:
script:
- make test
diff --git a/README.md b/README.md
index 903184b..15e9863 100644
--- a/README.md
+++ b/README.md
@@ -105,6 +105,15 @@ Some advice if you want to make a successful contribution:
- Get early feedback, specially when working on a large contribution
- Contributions always require a pull request and a review
+### Formatting
+
+This project uses [Black](https://github.com/psf/black) to format the Python
+code, and this is checked in CI.
+
+Before submitting any code to review, ensure you have installed Black 22.1.0 and run:
+
+ black .
+
## Authors
This was mostly written by Juan J. Martinez during the development of
diff --git a/tests/test_rom.py b/tests/test_rom.py
index d980dad..30e8d33 100755
--- a/tests/test_rom.py
+++ b/tests/test_rom.py
@@ -31,9 +31,8 @@ class TestRom(unittest.TestCase):
self.assertEqual(len(self.data), self.ROM_SIZE)
def test_header_main_init_address(self):
- self.assertEqual(struct.unpack(
- "<H", self.data[2:4]), (self.main_init,))
+ self.assertEqual(struct.unpack("<H", self.data[2:4]), (self.main_init,))
-if __name__ == '__main__':
+if __name__ == "__main__":
unittest.main()