From 54b0bec463adb2c0e5db241e5378828a824e9909 Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Fri, 15 Dec 2023 15:53:27 +0100 Subject: [PATCH] CI dummpy dependencies --- .github/workflows/ci.yml | 7 +++++++ _pip_install_dummy.py | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 _pip_install_dummy.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd4478a..3fb5b4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,13 @@ jobs: - uses: actions/setup-python@v5 with: python-version: '3.11' + - name: Dummy dependencies + run: | + python3 _pip_install_dummy.py PyGObject 3.99 + python3 _pip_install_dummy.py pySerial 3.5 + python3 _pip_install_dummy.py Pillow 7.1 + python3 _pip_install_dummy.py scour 0.37 + python3 _pip_install_dummy.py tinycss2 1.0 - run: pip install -r requirements.txt pytest - name: Test run: | diff --git a/_pip_install_dummy.py b/_pip_install_dummy.py new file mode 100644 index 0000000..b651697 --- /dev/null +++ b/_pip_install_dummy.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +""" +Create a dummy Python package and install it with pip. +""" + +import sys +import subprocess +import tempfile +from pathlib import Path + +name, version = sys.argv[1:] + +pyprojectbody = f"""[project] +name = "{name}" +version = "{version}" +""" + +with tempfile.TemporaryDirectory() as tmpdirname: + assert isinstance(tmpdirname, str) + pyprojectpath = Path(tmpdirname) / "pyproject.toml" + pyprojectpath.write_text(pyprojectbody) + subprocess.check_call([sys.executable, "-m", "pip", "install", tmpdirname])