From 71e713c72211fcb3de019ce1f926ca67ff71cd62 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 28 Aug 2020 17:17:07 +0200 Subject: [PATCH] pyln-testing: Bump version to 0.9.0 and add Makefile for release --- contrib/pyln-testing/Makefile | 46 +++++++++++++++++++ contrib/pyln-testing/pyln/testing/__init__.py | 2 +- contrib/pyln-testing/pyln/testing/fixtures.py | 3 +- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 contrib/pyln-testing/Makefile diff --git a/contrib/pyln-testing/Makefile b/contrib/pyln-testing/Makefile new file mode 100644 index 000000000..79eba98b6 --- /dev/null +++ b/contrib/pyln-testing/Makefile @@ -0,0 +1,46 @@ +#! /usr/bin/make + +.PHONY: bdist sdist release check check-source check-flake8 check-mypy +VERSION = $(shell python3 -c 'from pyln import testing;print(testing.__version__)') + +SDIST_FILE = "dist/pyln-testing-$(VERSION).tar.gz" +BDIST_FILE = "dist/pyln_testing-$(VERSION)-py3-none-any.whl" +ARTEFACTS = $(BDIST_FILE) $(SDIST_FILE) + +check: +# pytest + +check-source: check-flake8 check-mypy + +check-flake8: + flake8 --ignore=E501,E731,W503 + +# mypy . does not recurse. I have no idea why... +check-mypy: + mypy --ignore-missing-imports `find pyln/testing -name '*.py'` + +$(SDIST_FILE): + python3 setup.py sdist + +$(BDIST_FILE): + python3 setup.py bdist_wheel + +test-release: check $(ARTEFACTS) + python3 -m twine upload --repository testpypi --skip-existing $(ARTEFACTS) + + # Create a test virtualenv, install from the testpypi and run the + # tests against it (make sure not to use any virtualenv that may have + # pyln-testing already installed). + virtualenv testpypi --python=/usr/bin/python3 --download --always-copy --clear + # Install the requirements from the prod repo, they are not being kept up to date on the test repo + testpypi/bin/python3 -m pip install -r requirements.txt flaky pytest-timeout + testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-testing + testpypi/bin/python3 -c "from pyln import testing;assert(testing.__version__ == '$(VERSION)')" + testpypi/bin/pytest tests + rm -rf testpypi + +prod-release: test-release $(ARTEFACTS) + python3 -m twine upload $(ARTEFACTS) + +clean: + rm -rf testpypi diff --git a/contrib/pyln-testing/pyln/testing/__init__.py b/contrib/pyln-testing/pyln/testing/__init__.py index 3b93d0be0..3e2f46a3a 100644 --- a/contrib/pyln-testing/pyln/testing/__init__.py +++ b/contrib/pyln-testing/pyln/testing/__init__.py @@ -1 +1 @@ -__version__ = "0.0.2" +__version__ = "0.9.0" diff --git a/contrib/pyln-testing/pyln/testing/fixtures.py b/contrib/pyln-testing/pyln/testing/fixtures.py index 3f32a6561..40fee2cf2 100644 --- a/contrib/pyln-testing/pyln/testing/fixtures.py +++ b/contrib/pyln-testing/pyln/testing/fixtures.py @@ -1,6 +1,7 @@ from concurrent import futures from pyln.testing.db import SqliteDbProvider, PostgresDbProvider from pyln.testing.utils import NodeFactory, BitcoinD, ElementsD, env, DEVELOPER, LightningNode, TEST_DEBUG +from typing import Dict import logging import os @@ -13,7 +14,7 @@ import tempfile # A dict in which we count how often a particular test has run so far. Used to # give each attempt its own numbered directory, and avoid clashes. -__attempts = {} +__attempts: Dict[str, int] = {} @pytest.fixture(scope="session")