Compare commits

..

5 Commits

Author SHA1 Message Date
Gilles Boccon-Gibod 34161e5e14 add test.release task to facilitate CI integration 2022-08-16 13:30:45 -07:00
Ray 216ce2abd0 Add release tasks (#6)
Added two tasks to tasks.py, release and release_tests.

Applied black formatter

authored-by: Raymundo Ramirez Mata <raymundora@google.com>
2022-08-16 11:50:30 -07:00
Gilles Boccon-Gibod 431445e6a2 fix imports (#25) 2022-08-16 11:29:56 -07:00
Michael Mogenson d7cc546248 Update supported commands in console.py docs (#24)
Co-authored-by: Michael Mogenson <mogenson@google.com>
2022-08-12 14:23:21 -07:00
Gilles Boccon-Gibod 29fd19f40d gbg/fix subscribe lambda (#23)
* don't use a lambda as a subscriber

* update tests to look at side effects instead of internals
2022-08-12 14:22:31 -07:00
6 changed files with 44 additions and 23 deletions
+2 -2
View File
@@ -29,11 +29,11 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
python -m pip install ".[test,development,documentation]" python -m pip install ".[build,test,development,documentation]"
- name: Test with pytest - name: Test with pytest
run: | run: |
pytest pytest
- name: Build - name: Build
run: | run: |
inv build inv build
inv mkdocs inv build.mkdocs
+1 -1
View File
@@ -20,11 +20,11 @@ import logging
import struct import struct
from colors import color from colors import color
from pyee import EventEmitter
from .core import BT_CENTRAL_ROLE, InvalidStateError, ProtocolError from .core import BT_CENTRAL_ROLE, InvalidStateError, ProtocolError
from .hci import (HCI_LE_Connection_Update_Command, HCI_Object, key_with_value, from .hci import (HCI_LE_Connection_Update_Command, HCI_Object, key_with_value,
name_or_number) name_or_number)
from .utils import EventEmitter
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Logging # Logging
+3 -2
View File
@@ -17,9 +17,10 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import logging import logging
import asyncio import asyncio
from colors import color
from .utils import EventEmitter from colors import color
from pyee import EventEmitter
from .core import InvalidStateError, ProtocolError, ConnectionError from .core import InvalidStateError, ProtocolError, ConnectionError
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
+4 -2
View File
@@ -7,10 +7,12 @@ The Console app is an interactive text user interface that offers a number of fu
* scanning * scanning
* advertising * advertising
* connecting to devices * connecting to and disconnecting from devices
* changing connection parameters * changing connection parameters
* enabling encryption
* discovering GATT services and characteristics * discovering GATT services and characteristics
* read & write GATT characteristics * reading and writing GATT characteristics
* subscribing to and unsubscribing from GATT characteristics
The console user interface has 3 main panes: The console user interface has 3 main panes:
+2 -1
View File
@@ -57,12 +57,13 @@ console_scripts =
bumble-link-relay = bumble.apps.link_relay.link_relay:main bumble-link-relay = bumble.apps.link_relay.link_relay:main
[options.extras_require] [options.extras_require]
build =
build >= 0.7
test = test =
pytest >= 6.2 pytest >= 6.2
pytest-asyncio >= 0.17 pytest-asyncio >= 0.17
development = development =
invoke >= 1.4 invoke >= 1.4
build >= 0.7
nox >= 2022 nox >= 2022
documentation = documentation =
mkdocs >= 1.2.3 mkdocs >= 1.2.3
+32 -15
View File
@@ -23,35 +23,52 @@ ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
ns = Collection() ns = Collection()
# Building
build_tasks = Collection() build_tasks = Collection()
ns.add_collection(build_tasks, name='build') ns.add_collection(build_tasks, name="build")
@task @task
def build(ctx): def build(ctx, install=False):
ctx.run('python -m build') if install:
ctx.run('python -m pip install .[build]')
build_tasks.add_task(build, default=True, name='build') ctx.run("python -m build")
build_tasks.add_task(build, default=True)
@task
def release_build(ctx):
build(ctx, install=True)
build_tasks.add_task(release_build, name="release")
@task
def mkdocs(ctx):
ctx.run("mkdocs build -f docs/mkdocs/mkdocs.yml")
build_tasks.add_task(mkdocs, name="mkdocs")
# Testing
test_tasks = Collection() test_tasks = Collection()
ns.add_collection(test_tasks, name='test') ns.add_collection(test_tasks, name="test")
@task @task
def test(ctx, filter=None, junit=False): def test(ctx, filter=None, junit=False, install=False):
# Install the package before running the tests
if install:
ctx.run("python -m pip install .[test]")
args = "" args = ""
if junit: if junit:
args += "--junit-xml test-results.xml" args += "--junit-xml test-results.xml"
if filter is not None: if filter is not None:
args += " -k '{}'".format(filter) args += " -k '{}'".format(filter)
ctx.run('python -m pytest {} {}' ctx.run("python -m pytest {} {}".format(os.path.join(ROOT_DIR, "tests"), args))
.format(os.path.join(ROOT_DIR, "tests"), args))
test_tasks.add_task(test, name='test', default=True)
test_tasks.add_task(test, default=True)
@task @task
def mkdocs(ctx): def release_test(ctx):
ctx.run('mkdocs build -f docs/mkdocs/mkdocs.yml') test(ctx, install=True)
test_tasks.add_task(release_test, name="release")
ns.add_task(mkdocs)