diff --git a/Makefile b/Makefile index 238d87f4..103ddfeb 100644 --- a/Makefile +++ b/Makefile @@ -14,18 +14,6 @@ .PHONY: default help test-unit test-integration test-remote upload-coverage upload-pypi clean prepare -PACKAGE_NAME = rethinkdb - -PROTO_FILE_NAME = ql2.proto -PROTO_FILE_URL = https://raw.githubusercontent.com/rethinkdb/rethinkdb/next/src/rdb_protocol/${PROTO_FILE_NAME} -TARGET_PROTO_FILE = ${PACKAGE_NAME}/${PROTO_FILE_NAME} - -FILE_CONVERTER_NAME = ./scripts/convert_protofile.py -REMOTE_TEST_SETUP_NAME = ./scripts/prepare_remote_test.py - -CONVERTED_PROTO_FILE_NAME = ql2_pb2.py -TARGET_CONVERTED_PROTO_FILE = ${PACKAGE_NAME}/${CONVERTED_PROTO_FILE_NAME} - default: help @@ -37,45 +25,42 @@ help: @echo " make test-integration Run integration tests" @echo " make test-remote Run tests on digital ocean" @echo " make upload-coverage Upload unit test coverage" - @echo " make upload-pypi Release ${PACKAGE_NAME} package to PyPi" + @echo " make upload-pypi Release rethinkdb package to PyPi" @echo " make clean Cleanup source directory" - @echo " make prepare Prepare ${PACKAGE_NAME} for build" + @echo " make prepare Prepare rethinkdb for build" -test-unit: +test-unit: prepare pytest -v -m unit -test-integration: - @rebirthdb& +test-integration: prepare + @rethinkdb& pytest -v -m integration - @killall rebirthdb + @killall rethinkdb -test-ci: - @rebirthdb& +test-ci: prepare + @rethinkdb& pytest -v --cov rethinkdb --cov-report xml - @killall rebirthdb + @killall rethinkdb -test-remote: - curl -qo ${REMOTE_TEST_SETUP_NAME} ${REMOTE_TEST_SETUP_URL} - python ${REMOTE_TEST_SETUP_NAME} pytest -m integration +test-remote: prepare scripts/prepare_remote_test.py + python scripts/prepare_remote_test.py pytest -m integration install-db: - @sh scripts/install-db.sh + scripts/install-db.sh -upload-coverage: - @sh scripts/upload-coverage.sh +upload-coverage: prepare + scripts/upload-coverage.sh upload-pypi: prepare - @sh scripts/upload-pypi.sh + scripts/upload-pypi.sh clean: - @rm -rf \ - ${TARGET_PROTO_FILE} \ - ${TARGET_CONVERTED_PROTO_FILE} \ - .pytest_cache \ - .eggs \ - .dist \ - *.egg-info + git clean -dfx + +rethinkdb/ql2.proto: + curl -qo $@ https://raw.githubusercontent.com/rethinkdb/rethinkdb/next/src/rdb_protocol/ql2.proto + +rethinkdb/ql2_pb2.py: scripts/convert_protofile.py rethinkdb/ql2.proto + python scripts/convert_protofile.py -l python -i rethinkdb/ql2.proto -o rethinkdb/ql2_pb2.py -prepare: - curl -qo ${TARGET_PROTO_FILE} ${PROTO_FILE_URL} - python ${FILE_CONVERTER_NAME} -l python -i ${TARGET_PROTO_FILE} -o ${TARGET_CONVERTED_PROTO_FILE} +prepare: rethinkdb/ql2_pb2.py diff --git a/tests/mock_server.py b/tests/mock_server.py new file mode 100644 index 00000000..fc567320 --- /dev/null +++ b/tests/mock_server.py @@ -0,0 +1,5 @@ +# this is mocking at the layer just above the protocol +# testing of the protocol is left to integration tests + +class RethinkDBMock: + pass