-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
73 lines (59 loc) · 1.85 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import nox
nox.options.sessions = ["test"]
dev_deps = ["maturin", "pygal", "pygaljs", "pytest", "pytest-benchmark[histogram]", "maxminddb"]
lint_deps = ["autopep8", "black", "isort", "flake8"]
@nox.session
def test(session):
session.install(*dev_deps)
session.run_always("maturin", "develop")
session.run("pytest", "--benchmark-skip")
@nox.session(python=False)
def test_linux_docker(session):
# In order to run in Linux environment, while developing on another OS
import os
session.run("docker", "build", "-t", "pandas_maxminddb", ".")
pwd = os.getcwd()
session.run(
"docker",
"run",
"--rm",
"-t",
"-v",
f"{pwd}:/code",
"pandas_maxminddb",
"/root/.cargo/bin/cargo",
"test",
"--no-default-features",
)
@nox.session
def test_wheel_release(session):
session.install(*dev_deps)
session.run_always("rm", "-rf", "target/wheels", external=True)
session.run_always("maturin", "build", "--release", "--sdist")
session.run("pip", "download", "-d", "target/pip_deps", ".")
session.install(
"pandas_maxminddb",
"--no-index",
"--find-links",
"target/wheels",
"--find-links",
"target/pip_deps",
"--force-reinstall",
)
session.run("python", "-c", "import pandas_maxminddb")
@nox.session
def bench(session):
session.install(*dev_deps)
session.install(".")
session.run("pytest", "--benchmark-only", "--benchmark-histogram")
@nox.session(reuse_venv=True)
def lint(session):
session.install(*lint_deps)
session.run("black", "--check", ".")
session.run("flake8", ".")
@nox.session(reuse_venv=True)
def format(session):
session.install(*lint_deps)
session.run("isort", ".")
session.run("autopep8", "--in-place", "--recursive", ".")
session.run("black", ".")