Improved dependency management (#137)

* Improved env_setup.py
* split requirements into two sets: test and dev
* Removed deprecated param in a test
* Added additional dependencies
This commit is contained in:
Carter Tinney 2019-07-16 11:11:28 -07:00 коммит произвёл GitHub
Родитель c001a55cfb
Коммит 54994fbb7e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 33 добавлений и 22 удалений

Просмотреть файл

@ -55,7 +55,7 @@ class TestGetRunningLoop(object):
@pytest.mark.skipif(sys.version_info >= (3, 7), reason="Requires Python 3.6 or below")
async def test_raises_runtime_error_if_no_running_event_loop_py36orless_compat(self, mocker):
mocker.patch.object(asyncio, "_get_running_loop", return_value=None)
with pytest.raises(RuntimeError, message="Expecting Runtime Error"):
with pytest.raises(RuntimeError):
asyncio_compat.get_running_loop()

Просмотреть файл

@ -42,17 +42,31 @@ if __name__ == "__main__":
if os.path.dirname(p) not in ns_packages
]
# Make sure pip is on the latest version
pip_command("install --upgrade pip")
# Install nspkgs first (2.7 only)
if sys.version_info < (3, 0, 0):
for package_name in ns_packages:
pip_command("install -e {}".format(package_name))
# Use an eager upgrade strategy to make sure we have all the latest dependencies.
# This way we will be running into any dependency-related bugs before customers do.
pip_command("install -U --upgrade-strategy eager -e {}".format(package_name))
# Install packages
for package_name in packages:
pip_command("install -e {}".format(package_name))
# Use an eager upgrade strategy to make sure we have all the latest dependencies.
# This way we will be running into any dependency-related bugs before customers do.
pip_command("install -U --upgrade-strategy eager -e {}".format(package_name))
# Because we're just installing development environment libraries beyond this point, no need to
# be eager in upgrading, as these dependencies are not customer facing.
# Install testing environment dependencies
pip_command("install -U -r requirements_test.txt")
# Install other development environment dependencies
pip_command("install -r requirements.txt")
if args.dev_mode:
# Install local development environment dependencies.
# These are not compatible on all platforms.
pip_command("install -U -r requirements_dev.txt")
print("Installing pre-commit")
check_call("pre-commit install")

Просмотреть файл

@ -1,17 +0,0 @@
py==1.6.0
pytest==3.8.0
pytest-mock==1.10.0
pytest-asyncio==0.10.0; python_version >= '3.5'
pytest-testdox>=1.1.1
pytest-cov==2.6.0
wheel==0.32.1
paho-mqtt==1.4.0
transitions==0.6.8
flake8
msrest
six
mock
black; python_version >= '3.6'
pre-commit
janus; python_version >= '3.5'
twine

7
requirements_dev.txt Normal file
Просмотреть файл

@ -0,0 +1,7 @@
py
wheel>=0.32.1
black; python_version >= '3.6'
pre-commit
twine
pylint
rope

7
requirements_test.txt Normal file
Просмотреть файл

@ -0,0 +1,7 @@
pytest
pytest-mock
pytest-asyncio; python_version >= '3.5'
pytest-testdox>=1.1.1
pytest-cov
mock #remove this as soon as no references to it remain in the code
flake8