.PHONY: clean pip_dev test test_unit lint

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


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


env/bin/py.test:
	env/bin/python -m pip install -q -I -r requirements-dev.txt

pip_dev: env env/bin/py.test

test: pip_dev
	env/bin/python -m pytest tests \
		--cov snowflake_connector

test_unit: pip_dev
	env/bin/python -m pytest tests \
		--cov snowflake_connector \
		--cov-report xml \
		--junitxml=pyunit.xml

lint: pip_dev
	env/bin/python -m flake8 snowflake_connector/ tests/ *.py
