Skip to content

Commit 87e7cb2

Browse files
committed
Replaced Pipenv with Poetry
1 parent dd16958 commit 87e7cb2

File tree

4 files changed

+1124
-0
lines changed

4 files changed

+1124
-0
lines changed

.flake8

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[flake8]
2+
select = B,B9,BLK,C,E,F,I,S,W
3+
ignore = E203,E501,W503,E731,F405,F403,F401
4+
max-line-length = 128
5+
per-file-ignores = tests/*:S101
6+
import-order-style = google
7+
application-import-names = src,tests

noxfile.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import tempfile
2+
3+
import nox
4+
5+
locations = "demo", "natrix", "tests", "noxfile.py"
6+
7+
8+
def install_with_constraints(session, *args, **kwargs):
9+
with tempfile.NamedTemporaryFile() as requirements:
10+
session.run(
11+
"poetry",
12+
"export",
13+
"--dev",
14+
"--format=requirements.txt",
15+
"--without-hashes",
16+
f"--output={requirements.name}",
17+
external=True,
18+
)
19+
session.install(f"--constraint={requirements.name}", *args, **kwargs)
20+
21+
22+
@nox.session(python="3.7")
23+
def black(session):
24+
args = session.posargs or locations
25+
install_with_constraints(session, "black")
26+
session.run("black", *args)
27+
28+
29+
@nox.session(python="3.7")
30+
def lint(session):
31+
args = session.posargs or locations
32+
install_with_constraints(
33+
session,
34+
"flake8",
35+
"flake8-bandit",
36+
"flake8-black",
37+
"flake8-bugbear",
38+
"flake8-import-order",
39+
)
40+
session.run("flake8", *args)
41+
42+
43+
@nox.session(python="3.7")
44+
def safety(session):
45+
with tempfile.NamedTemporaryFile() as requirements:
46+
session.run(
47+
"poetry",
48+
"export",
49+
"--dev",
50+
"--format=requirements.txt",
51+
"--without-hashes",
52+
f"--output={requirements.name}",
53+
external=True,
54+
)
55+
install_with_constraints(session, "safety")
56+
session.run("safety", "check", f"--file={requirements.name}", "--full-report")
57+
58+
59+
@nox.session(python="3.7")
60+
def tests(session):
61+
args = session.posargs or ["--cov", "-m", "not e2e"]
62+
session.run("poetry", "install", "--no-dev", external=True)
63+
install_with_constraints(session, "pytest", "pytest-mock")
64+
session.run("pytest", *args)

0 commit comments

Comments
 (0)