Add workflow for testing python setup
This commit is contained in:
parent
18312707fe
commit
67ddca1d9c
33 changed files with 495 additions and 0 deletions
32
python-setup/tests/check_requests_123.sh
Normal file
32
python-setup/tests/check_requests_123.sh
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
EXPECTED_VERSION=$1
|
||||
|
||||
FOUND_VERSION="$LGTM_PYTHON_SETUP_VERSION"
|
||||
FOUND_PYTHONPATH="$LGTM_INDEX_IMPORT_PATH"
|
||||
|
||||
echo "FOUND_VERSION=${FOUND_VERSION} FOUND_PYTHONPATH=${FOUND_PYTHONPATH} "
|
||||
|
||||
if [[ $FOUND_VERSION != $EXPECTED_VERSION ]]; then
|
||||
echo "Script told us to use Python ${FOUND_VERSION}, but expected ${EXPECTED_VERSION}"
|
||||
exit 1
|
||||
else
|
||||
echo "Script told us to use Python ${FOUND_VERSION}, which was expected"
|
||||
fi
|
||||
|
||||
PYTHON_EXE="python${EXPECTED_VERSION}"
|
||||
|
||||
INSTALLED_REQUESTS_VERSION=$(PYTHONPATH="${FOUND_PYTHONPATH}" "${PYTHON_EXE}" -c 'import requests; print(requests.__version__)')
|
||||
|
||||
EXPECTED_REQUESTS="1.2.3"
|
||||
|
||||
if [[ "$INSTALLED_REQUESTS_VERSION" != "$EXPECTED_REQUESTS" ]]; then
|
||||
echo "Using ${FOUND_PYTHONPATH} as PYTHONPATH, we found version $INSTALLED_REQUESTS_VERSION of requests, but expected $EXPECTED_REQUESTS"
|
||||
exit 1
|
||||
else
|
||||
echo "Using ${FOUND_PYTHONPATH} as PYTHONPATH, we found version $INSTALLED_REQUESTS_VERSION of requests, which was expected"
|
||||
fi
|
||||
31
python-setup/tests/from_python_exe.py
Normal file
31
python-setup/tests/from_python_exe.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
from typing import Tuple
|
||||
|
||||
def get_details(path_to_python_exe: str) -> Tuple[str, str]:
|
||||
import_path = subprocess.check_output(
|
||||
[
|
||||
path_to_python_exe,
|
||||
"-c",
|
||||
"import os; import pip; print(os.path.dirname(os.path.dirname(pip.__file__)))",
|
||||
],
|
||||
stdin=subprocess.DEVNULL,
|
||||
)
|
||||
version = subprocess.check_output(
|
||||
[path_to_python_exe, "-c", "import sys; print(sys.version_info[0])"],
|
||||
stdin=subprocess.DEVNULL,
|
||||
)
|
||||
|
||||
return version.decode("utf-8").strip(), import_path.decode("utf-8").strip()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
version, import_path = get_details(sys.argv[1])
|
||||
|
||||
print("Setting LGTM_PYTHON_SETUP_VERSION={}".format(version))
|
||||
print("::set-env name=LGTM_PYTHON_SETUP_VERSION::{}".format(version))
|
||||
|
||||
print("Setting LGTM_INDEX_IMPORT_PATH={}".format(import_path))
|
||||
print("::set-env name=LGTM_INDEX_IMPORT_PATH::{}".format(import_path))
|
||||
12
python-setup/tests/pipenv/python-3.8/Pipfile
Normal file
12
python-setup/tests/pipenv/python-3.8/Pipfile
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[[source]]
|
||||
name = "pypi"
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[packages]
|
||||
requests = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.8"
|
||||
28
python-setup/tests/pipenv/python-3.8/Pipfile.lock
generated
Normal file
28
python-setup/tests/pipenv/python-3.8/Pipfile.lock
generated
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "2296b1fab66570fa3660c5e6a4e923332dcd7785814624c584be6623bc62c0e7"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
"python_version": "3.8"
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"name": "pypi",
|
||||
"url": "https://pypi.org/simple",
|
||||
"verify_ssl": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"default": {
|
||||
"requests": {
|
||||
"hashes": [
|
||||
"sha256:156bf3ec27ba9ec7e0cf8fbe02808718099d218de403eb64a714d73ba1a29ab1"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.2.3"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
[[source]]
|
||||
name = "pypi"
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[packages]
|
||||
requests = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.100"
|
||||
28
python-setup/tests/pipenv/python-version-not-available/Pipfile.lock
generated
Normal file
28
python-setup/tests/pipenv/python-version-not-available/Pipfile.lock
generated
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "2296b1fab66570fa3660c5e6a4e923332dcd7785814624c584be6623bc62c0e7"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
"python_version": "3.8"
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"name": "pypi",
|
||||
"url": "https://pypi.org/simple",
|
||||
"verify_ssl": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"default": {
|
||||
"requests": {
|
||||
"hashes": [
|
||||
"sha256:156bf3ec27ba9ec7e0cf8fbe02808718099d218de403eb64a714d73ba1a29ab1"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.2.3"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
}
|
||||
12
python-setup/tests/pipenv/requests-2/Pipfile
Normal file
12
python-setup/tests/pipenv/requests-2/Pipfile
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[[source]]
|
||||
name = "pypi"
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[packages]
|
||||
requests = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "2.7"
|
||||
28
python-setup/tests/pipenv/requests-2/Pipfile.lock
generated
Normal file
28
python-setup/tests/pipenv/requests-2/Pipfile.lock
generated
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "fba50410545d38a2f88b8d6964eb292055389e363b5c75a56b01ec80e7de14c1"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
"python_version": "2.7"
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"name": "pypi",
|
||||
"url": "https://pypi.org/simple",
|
||||
"verify_ssl": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"default": {
|
||||
"requests": {
|
||||
"hashes": [
|
||||
"sha256:156bf3ec27ba9ec7e0cf8fbe02808718099d218de403eb64a714d73ba1a29ab1"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.2.3"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
}
|
||||
11
python-setup/tests/pipenv/requests-3/Pipfile
Normal file
11
python-setup/tests/pipenv/requests-3/Pipfile
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[[source]]
|
||||
name = "pypi"
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[packages]
|
||||
requests = "*"
|
||||
|
||||
[requires]
|
||||
28
python-setup/tests/pipenv/requests-3/Pipfile.lock
generated
Normal file
28
python-setup/tests/pipenv/requests-3/Pipfile.lock
generated
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "2296b1fab66570fa3660c5e6a4e923332dcd7785814624c584be6623bc62c0e7"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
"python_version": "3.8"
|
||||
},
|
||||
"sources": [
|
||||
{
|
||||
"name": "pypi",
|
||||
"url": "https://pypi.org/simple",
|
||||
"verify_ssl": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"default": {
|
||||
"requests": {
|
||||
"hashes": [
|
||||
"sha256:156bf3ec27ba9ec7e0cf8fbe02808718099d218de403eb64a714d73ba1a29ab1"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==1.2.3"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
}
|
||||
16
python-setup/tests/poetry/python-3.8/poetry.lock
generated
Normal file
16
python-setup/tests/poetry/python-3.8/poetry.lock
generated
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[[package]]
|
||||
category = "main"
|
||||
description = "Python HTTP for Humans."
|
||||
name = "requests"
|
||||
optional = false
|
||||
python-versions = "^3.8"
|
||||
version = "1.2.3"
|
||||
|
||||
[metadata]
|
||||
content-hash = "b1abdce30bbdad3ac786dafe6840129df522cae3c5988f9ba8061320e3c1a34e"
|
||||
python-versions = "^3.8"
|
||||
|
||||
[metadata.files]
|
||||
requests = [
|
||||
{file = "requests-1.2.3.tar.gz", hash = "sha256:156bf3ec27ba9ec7e0cf8fbe02808718099d218de403eb64a714d73ba1a29ab1"},
|
||||
]
|
||||
15
python-setup/tests/poetry/python-3.8/pyproject.toml
Normal file
15
python-setup/tests/poetry/python-3.8/pyproject.toml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[tool.poetry]
|
||||
name = "autoinstall-test"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Your Name <you@example.com>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.8"
|
||||
requests = "*"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
build-backend = "poetry.masonry.api"
|
||||
16
python-setup/tests/poetry/python-version-not-available/poetry.lock
generated
Normal file
16
python-setup/tests/poetry/python-version-not-available/poetry.lock
generated
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[[package]]
|
||||
category = "main"
|
||||
description = "Python HTTP for Humans."
|
||||
name = "requests"
|
||||
optional = false
|
||||
python-versions = "^3.100"
|
||||
version = "1.2.3"
|
||||
|
||||
[metadata]
|
||||
content-hash = "b1abdce30bbdad3ac786dafe6840129df522cae3c5988f9ba8061320e3c1a34e"
|
||||
python-versions = "^3.100"
|
||||
|
||||
[metadata.files]
|
||||
requests = [
|
||||
{file = "requests-1.2.3.tar.gz", hash = "sha256:156bf3ec27ba9ec7e0cf8fbe02808718099d218de403eb64a714d73ba1a29ab1"},
|
||||
]
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
[tool.poetry]
|
||||
name = "autoinstall-test"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Your Name <you@example.com>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.100"
|
||||
requests = "*"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
build-backend = "poetry.masonry.api"
|
||||
16
python-setup/tests/poetry/requests-2/poetry.lock
generated
Normal file
16
python-setup/tests/poetry/requests-2/poetry.lock
generated
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[[package]]
|
||||
category = "main"
|
||||
description = "Python HTTP for Humans."
|
||||
name = "requests"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "1.2.3"
|
||||
|
||||
[metadata]
|
||||
content-hash = "b8c27a00aece20cb2ff6b3dcd394b1b5ef5e4acc3d7a059cfeb9f9cc11c9eff4"
|
||||
python-versions = "^2.7"
|
||||
|
||||
[metadata.files]
|
||||
requests = [
|
||||
{file = "requests-1.2.3.tar.gz", hash = "sha256:156bf3ec27ba9ec7e0cf8fbe02808718099d218de403eb64a714d73ba1a29ab1"},
|
||||
]
|
||||
15
python-setup/tests/poetry/requests-2/pyproject.toml
Normal file
15
python-setup/tests/poetry/requests-2/pyproject.toml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[tool.poetry]
|
||||
name = "autoinstall-test"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Your Name <you@example.com>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^2.7"
|
||||
requests = "*"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
build-backend = "poetry.masonry.api"
|
||||
16
python-setup/tests/poetry/requests-3/poetry.lock
generated
Normal file
16
python-setup/tests/poetry/requests-3/poetry.lock
generated
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[[package]]
|
||||
category = "main"
|
||||
description = "Python HTTP for Humans."
|
||||
name = "requests"
|
||||
optional = false
|
||||
python-versions = "^3.5"
|
||||
version = "1.2.3"
|
||||
|
||||
[metadata]
|
||||
content-hash = "b1abdce30bbdad3ac786dafe6840129df522cae3c5988f9ba8061320e3c1a34e"
|
||||
python-versions = "^3.5"
|
||||
|
||||
[metadata.files]
|
||||
requests = [
|
||||
{file = "requests-1.2.3.tar.gz", hash = "sha256:156bf3ec27ba9ec7e0cf8fbe02808718099d218de403eb64a714d73ba1a29ab1"},
|
||||
]
|
||||
15
python-setup/tests/poetry/requests-3/pyproject.toml
Normal file
15
python-setup/tests/poetry/requests-3/pyproject.toml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[tool.poetry]
|
||||
name = "autoinstall-test"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Your Name <you@example.com>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.5"
|
||||
requests = "*"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
build-backend = "poetry.masonry.api"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
# non-existing package
|
||||
ajsdiofjasodinfkajsndfoiuqwhefoanisdfojnasdofas
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
# valid package with invalid version
|
||||
requests==10000
|
||||
|
|
@ -0,0 +1 @@
|
|||
requests==1.2.3
|
||||
|
|
@ -0,0 +1 @@
|
|||
print('hello')
|
||||
|
|
@ -0,0 +1 @@
|
|||
requests==1.2.3
|
||||
3
python-setup/tests/requirements/requests-2/setup.py
Normal file
3
python-setup/tests/requirements/requests-2/setup.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# fake setup.py with Trove classifier to fool Python extractor to believe this is Python 2 for sure
|
||||
|
||||
# Programming Language :: Python :: 2.7
|
||||
|
|
@ -0,0 +1 @@
|
|||
requests==1.2.3
|
||||
3
python-setup/tests/requirements/requests-3/setup.py
Normal file
3
python-setup/tests/requirements/requests-3/setup.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# fake setup.py with Trove classifier to fool Python extractor to believe this is Python 3 for sure
|
||||
|
||||
# Programming Language :: Python :: 3.7
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
from setuptools import setup
|
||||
|
||||
# has fake Trove classifier to fool Python extractor to believe this is Python 3 for sure
|
||||
|
||||
# Programming Language :: Python :: 3.7
|
||||
|
||||
setup(
|
||||
name="example-setup.py",
|
||||
install_requires=[],
|
||||
extras_require={"all": ["requests==1.2.3"]}
|
||||
)
|
||||
1
python-setup/tests/setup_py/invalid-file/setup.py
Normal file
1
python-setup/tests/setup_py/invalid-file/setup.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
raise Exception("some kind of error")
|
||||
6
python-setup/tests/setup_py/invalid-version/setup.py
Normal file
6
python-setup/tests/setup_py/invalid-version/setup.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name="example-setup.py",
|
||||
install_requires=["requests==10000"],
|
||||
)
|
||||
12
python-setup/tests/setup_py/requests-2/setup.py
Normal file
12
python-setup/tests/setup_py/requests-2/setup.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from setuptools import setup
|
||||
|
||||
# has fake Trove classifier to fool Python extractor to believe this is Python 2 for sure
|
||||
|
||||
# Programming Language :: Python :: 2.7
|
||||
|
||||
|
||||
setup(
|
||||
name="example-setup.py",
|
||||
install_requires=["requests==1.2.3"],
|
||||
python_requires=">=2.7, <3",
|
||||
)
|
||||
12
python-setup/tests/setup_py/requests-3/setup.py
Normal file
12
python-setup/tests/setup_py/requests-3/setup.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from setuptools import setup
|
||||
|
||||
# has fake Trove classifier to fool Python extractor to believe this is Python 3 for sure
|
||||
|
||||
# Programming Language :: Python :: 3.7
|
||||
|
||||
|
||||
setup(
|
||||
name="example-setup.py",
|
||||
install_requires=["requests==1.2.3"],
|
||||
python_requires='>=3.5',
|
||||
)
|
||||
12
python-setup/tests/setup_py/wrong-python-version/setup.py
Normal file
12
python-setup/tests/setup_py/wrong-python-version/setup.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from setuptools import setup
|
||||
|
||||
# has fake Trove classifier to fool Python extractor to believe this is Python 3 for sure
|
||||
|
||||
# Programming Language :: Python :: 3.7
|
||||
|
||||
|
||||
setup(
|
||||
name="example-setup.py",
|
||||
install_requires=["requests==1.2.3"],
|
||||
python_requires=">=2.7, <3",
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue