Skip to content

Commit

Permalink
Switch to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ksiazkowicz committed Apr 3, 2020
1 parent 8547832 commit 2286518
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 34 deletions.
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
[run]
source = libband

[report]
exclude_lines =
pragma: no cover
if TYPE_CHECKING

[xml]
output = build/coverage.xml
39 changes: 39 additions & 0 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Python package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python_version: [3.7]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libbluetooth-dev
pip install -r requirements.txt
- name: Lint with flake8
run: |
flake8
- name: Test with pytest
run: |
pytest --cov --cov-report xml
- name: Uploading coverage
uses: codecov/codecov-action@v1
with:
file: ./build/coverage.xml # optional
flags: unittests # optional
name: codecov-umbrella # optional
9 changes: 0 additions & 9 deletions Dockerfile

This file was deleted.

22 changes: 0 additions & 22 deletions buildspec.yml

This file was deleted.

7 changes: 5 additions & 2 deletions libband/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ class BandSocket:
def __init__(self, device=None, port=CARGO_SERVICE_PORT):
self.device = device
self.port = port
self.socket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
self.socket = self._make_socket()

def _make_socket(self):
return bluetooth.BluetoothSocket(bluetooth.RFCOMM)

def connect(self, timeout=TIMEOUT):
self.reconnect_count = 0
self.device.wrapper.send("Status", [self.port, "Connecting"])
while True:
try:
self.socket.close()
self.socket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
self.socket = self._make_socket()
self.socket.connect((self.device.address, self.port))
break
except bluetooth.btcommon.BluetoothError as error:
Expand Down
3 changes: 3 additions & 0 deletions libband/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class MockBandSocket(BandSocket):
_received_packets = []
_expected_results = defaultdict(list)

def _make_socket(self):
return None

def call(self, packet=None, results=[]):
self._expected_results[packet].append(results)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pybluez
pybluez==0.23
unidecode==1.0.23
requests==2.21.0
geocoder==1.38.1
Expand Down

0 comments on commit 2286518

Please sign in to comment.