The previous attempt to allow this didn't actually allow it, so this is take two. As part of the previous attempt, I thought after tweaking the test I had observed the test failing, and then succeeding after making the product changes, but I must have been mistaken. It turns out that our existing mocks tests weren't running at all because of a missing `__init__.py` file. Once the missing `__init__.py` is added, the tests run, but other tests ("test mode" tests) fail because the code that creates the mocks and resources will run during test discovery, and setting the mocks modifies global state. To address the test issue, I've moved the mocks tests into their own `test_with_mocks` package that can be run separately from other tests. And addressed the original issue, by creating a root Stack resource if one isn't already present when the mocks are set.
55 lines
1.8 KiB
Makefile
55 lines
1.8 KiB
Makefile
PROJECT_NAME := Pulumi Python SDK
|
|
LANGHOST_PKG := github.com/pulumi/pulumi/sdk/v2/python/cmd/pulumi-language-python
|
|
VERSION := $(shell ../../scripts/get-version HEAD)
|
|
PYPI_VERSION := $(shell ../../scripts/get-py-version HEAD)
|
|
|
|
PYENV := ./env
|
|
PYENVSRC := $(PYENV)/src
|
|
|
|
include ../../build/common.mk
|
|
|
|
ensure::
|
|
pipenv --python 3 install --dev
|
|
mkdir -p $(PYENVSRC)
|
|
|
|
build_package::
|
|
rm -rf $(PYENVSRC) && cp -R ./lib/. $(PYENVSRC)/
|
|
sed -i.bak "s/\$${VERSION}/$(PYPI_VERSION)/g" $(PYENVSRC)/setup.py && rm $(PYENVSRC)/setup.py.bak
|
|
cp ../../README.md $(PYENVSRC)
|
|
cd $(PYENVSRC) && pipenv run python setup.py build bdist_wheel --universal
|
|
|
|
build_plugin::
|
|
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=${VERSION}" ${LANGHOST_PKG}
|
|
|
|
build:: build_package build_plugin
|
|
|
|
lint::
|
|
pipenv run mypy ./lib/pulumi --config-file=mypy.ini
|
|
pipenv run pylint ./lib/pulumi --rcfile=.pylintrc
|
|
|
|
install_package:: build_package
|
|
cp ./cmd/pulumi-language-python-exec "$(PULUMI_BIN)"
|
|
cp ./dist/pulumi-resource-pulumi-python "$(PULUMI_BIN)"
|
|
cp ./dist/pulumi-analyzer-policy-python "$(PULUMI_BIN)"
|
|
|
|
install_plugin:: build_plugin
|
|
GOBIN=$(PULUMI_BIN) go install \
|
|
-ldflags "-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=${VERSION}" ${LANGHOST_PKG}
|
|
|
|
install:: install_package install_plugin
|
|
|
|
test_fast:: build
|
|
pipenv run pip install ./env/src
|
|
pipenv run python -m unittest discover -s lib/test -v
|
|
pipenv run python -m unittest discover -s lib/test_with_mocks -v
|
|
|
|
test_all:: test_fast
|
|
|
|
dist::
|
|
go install -ldflags "-X github.com/pulumi/pulumi/sdk/v2/go/common/version.Version=${VERSION}" ${LANGHOST_PKG}
|
|
cp ./cmd/pulumi-language-python-exec "$$(go env GOPATH)"/bin/
|
|
cp ./dist/pulumi-resource-pulumi-python "$$(go env GOPATH)"/bin/
|
|
cp ./dist/pulumi-analyzer-policy-python "$$(go env GOPATH)"/bin/
|
|
|
|
brew:: dist
|