-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.py
58 lines (43 loc) · 1.37 KB
/
test.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
"""
This holds a couple handy commands that were in setup.py
before we moved to static builds using setup.cfg
"""
import os
import sys
import distutils.cmd
from setuptools import setup, find_packages
import subprocess
from uaa_client import VERSION
class SimpleCommand(distutils.cmd.Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
class ManualTestCommand(SimpleCommand):
description = "Run example app in a Docker container for manual testing."
SDIST_PATH = os.path.join("dist", "cg-django-uaa-{}.tar.gz".format(VERSION))
def run(self):
if not os.path.exists(self.SDIST_PATH):
print("Please run 'python -m build --sdist' first.")
sys.exit(1)
import django
django_version = django.get_version()
tag_name = "cg-django-uaa"
subprocess.check_call(
[
"docker",
"build",
"--build-arg",
"version={}".format(VERSION),
"--build-arg",
"django_version={}".format(django_version),
"-t",
tag_name,
".",
]
)
subprocess.check_call(
["docker", "run", "-it", "-p", "8000:8000", "--rm", tag_name]
)
setup(cmdclass={"manualtest": ManualTestCommand})