Run CI in an environment that includes Python, and test generated code (#2072)
* CI: use a docker image that includes Python So that tests of abi-gen generating Python can exercise the code being generated. * CI fix: disable old yarn permission denied hack Motivated by CI failure of previous commit. * CI fix: more resources for test-contracts-ganache Motivated by CI failure of previous commit. * CI fix: remove hack of permissions for python libs Fix for previous CI run's failure of test-python. Apparently we don't need this in the docker container we've switched to. * abi-gen/Py: minimum viable test of gen'd code Ensure the code is parseable by running it through black. * abi-gen/Py: expand Python linter usage Make abi-gen filter its output through black, if its available in the runtime environment. Accordingly, stop having contract_wrappers.py's setup.py pre_install run black on copied-over files. Adds Pylint to the list of linters run against test-cli/output. * abi-gen: re-enable Solidity linter It was broken, running seemingly cleanly but not actually reading any files, because it was targetting the wrong folder. * abi-gen/test-cli/fixtures/sol: fix linter errors * abi-gen/test-cli: disable pylint blackisted-name * abi-gen/Py: rm unused var in contracts w/o methods Remove unused variable from generated wrapper for contracts without any methods.
This commit is contained in:
@@ -7,7 +7,6 @@ from shutil import copy, rmtree
|
||||
from os import environ, path, remove
|
||||
from pathlib import Path
|
||||
from sys import argv
|
||||
from importlib.util import find_spec
|
||||
|
||||
from distutils.command.clean import clean
|
||||
import distutils.command.build_py
|
||||
@@ -15,9 +14,6 @@ from setuptools import find_packages, setup
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
|
||||
BLACK_COMMAND = "black --line-length 79 "
|
||||
|
||||
|
||||
CONTRACTS_TO_BE_WRAPPED = [
|
||||
"asset_proxy_owner",
|
||||
"coordinator",
|
||||
@@ -82,16 +78,6 @@ class PreInstallCommand(distutils.command.build_py.build_py):
|
||||
pkgdir, "src", "zero_ex", "contract_wrappers", contract
|
||||
),
|
||||
)
|
||||
if find_spec("black") is None:
|
||||
subprocess.check_call("pip install black".split()) # nosec
|
||||
black_command = BLACK_COMMAND + " ".join(
|
||||
[
|
||||
f"src/zero_ex/contract_wrappers/{contract}/__init__.py"
|
||||
for contract in CONTRACTS_TO_BE_WRAPPED
|
||||
]
|
||||
)
|
||||
print(f"Running command `{black_command}`...")
|
||||
subprocess.check_call(black_command.split()) # nosec
|
||||
|
||||
|
||||
class TestCommandExtension(TestCommand):
|
||||
@@ -114,7 +100,9 @@ class LintCommand(distutils.command.build_py.build_py):
|
||||
"""Run linter shell commands."""
|
||||
lint_commands = [
|
||||
# formatter:
|
||||
(BLACK_COMMAND + " --check --diff src test setup.py").split(),
|
||||
(
|
||||
"black --line-length 79 --check --diff src test setup.py"
|
||||
).split(),
|
||||
# style guide checker (formerly pep8):
|
||||
"pycodestyle src test setup.py".split(),
|
||||
# docstring style checker:
|
||||
|
Reference in New Issue
Block a user