@@ -2,72 +2,54 @@ PYTHON_VERSIONS = 3.9 3.10 3.11
2
2
PYTHON_VERSION ?= 3.10
3
3
IMAGE = testcontainers-python:${PYTHON_VERSION}
4
4
RUN = docker run --rm -it
5
- # Get all directories that contain a setup.py and get the directory name.
6
- PACKAGES = core $(addprefix modules/,$(notdir $(wildcard modules/* ) ) )
5
+ TEST_NAMES := $(notdir $(wildcard tests/* ) )
7
6
8
- # All */dist folders for each of the packages.
9
- DISTRIBUTIONS = $(addsuffix /dist,${PACKAGES})
10
- UPLOAD = $(addsuffix /upload,${PACKAGES})
11
- # All */tests folders for each of the test suites.
12
- TESTS = $(addsuffix /tests,$(filter-out meta,${PACKAGES}) )
7
+ TESTS := $(addprefix tests/,$(TEST_NAMES ) )
13
8
TESTS_DIND = $(addsuffix -dind,${TESTS})
14
- DOCTESTS = $(addsuffix /doctest,$(filter-out meta,${PACKAGES}) )
15
- # All linting targets.
16
- LINT = $(addsuffix /lint,${PACKAGES})
17
9
18
- # Targets to build a distribution for each package.
19
- dist : ${DISTRIBUTIONS}
20
- ${DISTRIBUTIONS} : % /dist : % /setup.py
21
- cd $* \
22
- && python setup.py bdist_wheel \
23
- && twine check dist/*
10
+ dist :
11
+ poetry build \
12
+ && poetry run twine check dist/* .tar.gz
24
13
25
14
# Targets to run the test suite for each package.
26
15
tests : ${TESTS}
27
- ${TESTS} : % / tests :
28
- poetry run pytest -v --cov=testcontainers.$* $* /tests
16
+ ${TESTS} : tests/ % :
17
+ poetry run pytest -v --cov=testcontainers.$* tests/ $*
29
18
30
19
# Target to lint the code.
31
20
lint :
32
21
pre-commit run -a
33
22
34
23
# Targets to publish packages.
35
- upload : ${UPLOAD}
36
- ${UPLOAD} : % /upload :
37
- if [ ${TWINE_REPOSITORY} -$* = testpypi-meta ]; then \
38
- echo " Cannot upload meta package to testpypi because of missing permissions." ; \
39
- else \
40
- twine upload --non-interactive --skip-existing $* /dist/* ; \
41
- fi
24
+ upload :
25
+ poetry run twine upload --non-interactive --skip-existing dist/*
42
26
43
27
# Targets to build docker images
44
28
image :
29
+ mkdir -p build/
45
30
poetry export -f requirements.txt -o build/requirements.txt
46
31
docker build --build-arg version=${PYTHON_VERSION} -t ${IMAGE} .
47
32
48
33
# Targets to run tests in docker containers
49
34
tests-dind : ${TESTS_DIND}
50
35
51
- ${TESTS_DIND} : % / tests-dind : image
36
+ ${TESTS_DIND} : tests/ % -dind : image
52
37
${RUN} -v /var/run/docker.sock:/var/run/docker.sock ${IMAGE} \
53
- bash -c " make $* / lint $* /tests "
38
+ bash -c " make lint tests/ $* "
54
39
55
40
# Target to build the documentation
56
41
docs :
57
42
poetry run sphinx-build -nW . docs/_build
58
43
59
- doctest : ${DOCTESTS}
44
+ doctest :
60
45
poetry run sphinx-build -b doctest . docs/_build
61
46
62
- ${DOCTESTS} : % /doctest :
63
- poetry run sphinx-build -b doctest -c doctests $* docs/_build
64
-
65
47
# Remove any generated files.
66
48
clean :
67
49
rm -rf docs/_build
68
- rm -rf * / build
69
- rm -rf * / dist
50
+ rm -rf build
51
+ rm -rf dist
70
52
rm -rf * /* .egg-info
71
53
72
54
# Targets that do not generate file-level artifacts.
73
- .PHONY : clean dists ${DISTRIBUTIONS} docs doctests image tests ${TESTS}
55
+ .PHONY : clean dists docs doctests image tests ${TESTS}
0 commit comments