This repository was archived by the owner on Dec 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathnoxfile.py
More file actions
55 lines (42 loc) · 1.3 KB
/
noxfile.py
File metadata and controls
55 lines (42 loc) · 1.3 KB
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
import os
import subprocess
import nox
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ['format', 'lint', 'test']
FILES = ['ilmsdump', 'ilmsserve', 'tests', 'noxfile.py', 'setup.py']
@nox.session
@nox.parametrize('formatter', ['isort', 'black'])
def format_check(session, formatter):
session.install(formatter)
session.run(formatter, '--check', '--diff', *FILES)
@nox.session
@nox.parametrize('formatter', ['isort', 'black'])
def format(session, formatter):
session.install(formatter)
session.run(formatter, *FILES)
@nox.session
def lint(session):
session.install('flake8')
session.run('flake8', *FILES)
@nox.session
def test(session):
session.install('-U', '.[dev]')
session.run('python', '-m', 'pytest', 'tests')
@nox.session
def test_ilmsmock(session):
session.install('-U', '.[dev]')
session.run('go', 'install', 'github.com/afq984/ilmsmock/cmd/ilmsmock@latest', external=True)
gopath = subprocess.check_output(['go', 'env', 'GOPATH']).decode('utf-8').strip()
ilmsmock = os.path.join(gopath, 'bin', 'ilmsmock')
if os.name == 'nt':
ilmsmock += '.exe'
session.run(
ilmsmock,
'--setenv=ILMSDUMP_TARGET_ORIGIN',
'--',
'python',
'-m',
'pytest',
'tests',
external=True,
)