# Add any tasks that are not dependent on files in the .PHONY list
.PHONY: clean test test_cov lint pip_dev

clean:
	rm -rf env .eggs build owsrequest.egg-info .cache .pytest_cache .coverage coverage.xml
	find . | grep -E '__pycache__|\.pyc|\.pyo$\' | xargs rm -rf

env:
	python3.11 -m venv env
	env/bin/python -m pip install -q -U pip setuptools wheel

pip_dev: env
	env/bin/python -m pip install -q -r requirements-dev.txt

test: pip_dev
	docker compose up -d
	env/bin/python -m pytest tests/ \
		--cov owsrequest \
		--cov-report xml \
		--junitxml=build/pyunit.xml || (docker compose down && exit 1)
	docker compose down

test_cov: pip_dev
	env/bin/python -m pytest tests/
		--cov owsrequest \
		--cov-report term-missing

lint: pip_dev
	env/bin/python -m flake8 owsrequest/ tests/ setup.py
