зеркало из https://github.com/Azure/iotedgedev.git
Configure travis for unit tests (#195)
* Mark tests and add travis configuration files
* Make sure the tests dir has an __init__
* Just test for now, lint is in a bad state
* Add click dependency for travis
* Move tests for the user's .env into the e2e tests
* Bring back all the py versions
* Try removing tests/__init__.py
* Include setuptools for virtualenvs that need the update
* Revert "Try removing tests/__init__.py"
This reverts commit 83265feb83
.
* Remove 3.3 and 2.6 from the python test envs
* Add Travis badge to README
This commit is contained in:
Родитель
d5dde6fb1a
Коммит
29ebe1d806
35
.travis.yml
35
.travis.yml
|
@ -1,29 +1,10 @@
|
|||
# Config file for automatic testing at travis-ci.org
|
||||
# This file will be regenerated if you run travis_pypi_setup.py
|
||||
|
||||
language: python
|
||||
python:
|
||||
- 3.5
|
||||
- 3.4
|
||||
- 3.3
|
||||
- 2.7
|
||||
- 2.6
|
||||
|
||||
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
|
||||
install: pip install -U tox-travis
|
||||
|
||||
# command to run tests, e.g. python setup.py test
|
||||
script: tox
|
||||
|
||||
# After you create the Github repo and add it to Travis, run the
|
||||
# travis_pypi_setup.py script to finish PyPI deployment setup
|
||||
deploy:
|
||||
provider: pypi
|
||||
distributions: sdist bdist_wheel
|
||||
user: jonbgallant
|
||||
password:
|
||||
secure: PLEASE_REPLACE_ME
|
||||
on:
|
||||
tags: true
|
||||
repo: azure/iotedgedev
|
||||
python: 2.7
|
||||
- "3.6"
|
||||
- "3.5"
|
||||
- "3.4"
|
||||
- "2.7"
|
||||
install:
|
||||
- pip install -r requirements_travis.txt
|
||||
script:
|
||||
- pytest -m unit # & pylint iotedgedev # or py.test for Python versions 3.5 and below
|
|
@ -1,5 +1,7 @@
|
|||
# Azure IoT Edge Dev Tool
|
||||
|
||||
[![Build Status](https://travis-ci.org/Azure/iotedgedev.svg?branch=master)](https://travis-ci.org/Azure/iotedgedev)
|
||||
|
||||
The **Azure IoT Edge Dev Tool** greatly simplifies [Azure IoT Edge](https:/azure.microsoft.com/en-us/services/iot-edge/) development down to simple commands driven by Environment Variables.
|
||||
|
||||
- It gets you started with IoT Edge development with the [IoT Edge Dev Container](#iot-edge-dev-container) and IoT Edge Solution Scaffolding that contains a sample module and all the required configuration files.
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[pytest]
|
||||
markers =
|
||||
e2e
|
||||
unit
|
|
@ -0,0 +1,5 @@
|
|||
-r requirements.txt
|
||||
pylint
|
||||
pytest
|
||||
setuptools
|
||||
click
|
|
@ -0,0 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""Test package for Azure IoT Edge Dev Tool ."""
|
||||
|
||||
__author__ = 'David Ruttka'
|
||||
__email__ = 'david.ruttka@microsoft.com'
|
||||
__version__ = '0.0.1'
|
|
@ -1,6 +1,8 @@
|
|||
import pytest
|
||||
from iotedgedev.azurecli import get_query_argument_for_id_and_name
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
def get_terms(query):
|
||||
# These tests are all asserting that the query contains two terms enclosed in
|
||||
# [?], separated by ||
|
||||
|
|
|
@ -3,6 +3,8 @@ import pytest
|
|||
from dotenv import load_dotenv
|
||||
from iotedgedev.connectionstring import ConnectionString, IoTHubConnectionString, DeviceConnectionString
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
emptystring = ""
|
||||
valid_connectionstring = "HostName=testhub.azure-devices.net;SharedAccessKey=gibberish"
|
||||
valid_iothub_connectionstring = "HostName=testhub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=moregibberish"
|
||||
|
@ -56,23 +58,4 @@ def test_invalid_devicehub_connectionstring():
|
|||
assert connectionstring.HostName == "testhub.azure-devices.net"
|
||||
assert connectionstring.HubName == "testhub"
|
||||
assert not connectionstring.DeviceId
|
||||
assert connectionstring.SharedAccessKey == "othergibberish"
|
||||
|
||||
def test_valid_env_iothub_connectionstring():
|
||||
load_dotenv(".env")
|
||||
env_iothub_connectionstring = os.getenv("IOTHUB_CONNECTION_STRING")
|
||||
connectionstring = IoTHubConnectionString(env_iothub_connectionstring)
|
||||
assert connectionstring.HostName
|
||||
assert connectionstring.HubName
|
||||
assert connectionstring.SharedAccessKey
|
||||
assert connectionstring.SharedAccessKeyName
|
||||
|
||||
def test_valid_env_device_connectionstring():
|
||||
load_dotenv(".env")
|
||||
env_device_connectionstring = os.getenv("DEVICE_CONNECTION_STRING")
|
||||
connectionstring = DeviceConnectionString(env_device_connectionstring)
|
||||
assert connectionstring.HostName
|
||||
assert connectionstring.HubName
|
||||
assert connectionstring.SharedAccessKey
|
||||
assert connectionstring.DeviceId
|
||||
|
||||
assert connectionstring.SharedAccessKey == "othergibberish"
|
|
@ -3,6 +3,8 @@ import pytest
|
|||
from iotedgedev.envvars import EnvVars
|
||||
from iotedgedev.output import Output
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
def test_valid_get_envvar():
|
||||
output = Output()
|
||||
envvars = EnvVars(output)
|
||||
|
|
|
@ -5,6 +5,8 @@ import pytest
|
|||
|
||||
from click.testing import CliRunner
|
||||
|
||||
pytestmark = pytest.mark.e2e
|
||||
|
||||
root_dir = os.getcwd()
|
||||
tests_dir = os.path.join(root_dir, "tests")
|
||||
env_file = os.path.join(root_dir, ".env")
|
||||
|
@ -220,6 +222,23 @@ def setup_node_solution(request):
|
|||
def test_node(setup_node_solution, test_push_modules, test_deploy_modules, test_start_runtime, test_monitor, test_stop):
|
||||
print('Testing Node Solution')
|
||||
|
||||
def test_valid_env_iothub_connectionstring():
|
||||
load_dotenv(".env")
|
||||
env_iothub_connectionstring = os.getenv("IOTHUB_CONNECTION_STRING")
|
||||
connectionstring = IoTHubConnectionString(env_iothub_connectionstring)
|
||||
assert connectionstring.HostName
|
||||
assert connectionstring.HubName
|
||||
assert connectionstring.SharedAccessKey
|
||||
assert connectionstring.SharedAccessKeyName
|
||||
|
||||
def test_valid_env_device_connectionstring():
|
||||
load_dotenv(".env")
|
||||
env_device_connectionstring = os.getenv("DEVICE_CONNECTION_STRING")
|
||||
connectionstring = DeviceConnectionString(env_device_connectionstring)
|
||||
assert connectionstring.HostName
|
||||
assert connectionstring.HubName
|
||||
assert connectionstring.SharedAccessKey
|
||||
assert connectionstring.DeviceId
|
||||
|
||||
'''
|
||||
def test_load_no_dotenv():
|
||||
|
|
Загрузка…
Ссылка в новой задаче