Skip to content

Commit

Permalink
Reorganize tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmicu committed Aug 17, 2021
1 parent 7fdd8b6 commit 20c56b8
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 29 deletions.
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@ help:
@echo " - help : Print this help message."
@echo " - clean : Remove generated files."
@echo " - coding-style : Run coding style tools."
@echo " - publish : Publish package to PyPI."
@echo " - publish : Publish package to PyPI."
@echo " - test : Run coding style tools and tests."

.PHONY: all
all: help

.PHONY: clean
clean:
rm -rf build dist editorconfig_checker.egg-info editorconfig_checker/bin
@rm -rf build dist editorconfig_checker.egg-info editorconfig_checker/bin tests/Dockerfile-*

.PHONY: coding-style
coding-style:
flake8 --ignore E501 setup.py
@flake8 --ignore E501 setup.py

.PHONY: publish
publish:
bash publish.sh
publish: clean test
@python3 setup.py sdist
@twine upload dist/*

.PHONY: test
test: coding-style
bash test.sh
@bash run-tests.sh
11 changes: 0 additions & 11 deletions publish.sh

This file was deleted.

21 changes: 14 additions & 7 deletions test.sh → run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
set -e

PY_DOCKER_IMAGES=("2.7.16-slim" "3.7.4-slim")
DOCKERFILE_TEMPLATE="tests/Dockerfile.template"

# "." -> Local package
# "editorconfig-checker" -> PyPI package
PACKAGES=("." "editorconfig-checker")
PACKAGES=()

DOCKERFILE_TEMPLATE="tests/Dockerfile.template"
# Local package
PACKAGES+=(".")
# PyPI package
PACKAGES+=("editorconfig-checker")

echo -e "Running tests...\n\n"

for py_docker_image in "${PY_DOCKER_IMAGES[@]}"; do
for package in "${PACKAGES[@]}"; do
Expand Down Expand Up @@ -40,12 +44,15 @@ for py_docker_image in "${PY_DOCKER_IMAGES[@]}"; do

# Run coding style tools
if [[ "$is_local" == "1" ]]; then
docker run --rm "$docker_image" make coding_style
docker run --rm "$docker_image" make coding-style
fi

# Run `editorconfig-checker`
docker run --rm "$docker_image" ec -version

# Remove the created image
docker image rm "$docker_image" > /dev/null
docker image rm "$docker_image" &> /dev/null

echo ""
echo -e "\n"
done
done
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from urllib2 import urlopen


WRAPPER_VERSION = '2.3.53'
WRAPPER_VERSION = '2.3.54'
EDITORCONFIG_CHECKER_CORE_VERSION = '2.3.5'
EDITORCONFIG_CHECKER_EXE_NAME = 'ec'

Expand Down
10 changes: 6 additions & 4 deletions tests/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ LABEL maintainer="Marco M. (mmicu) <[email protected]>"
COPY . /app
WORKDIR /app

RUN set -x \
&& apt-get update \
&& apt-get install -y make \
&& pip install -r dev_requirements.txt \
RUN bash

RUN set -x \
&& apt-get update \
&& apt-get install -y make \
&& pip install -r tests/requirements.txt \
&& pip install --no-cache-dir $PACKAGE
File renamed without changes.

0 comments on commit 20c56b8

Please sign in to comment.