Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[flake8]
select = E901,E999,F821,F822,F823
max-line-length = 100
exclude = .git,.eggs,__pycache__,build,dist,venv
exclude = .git,.eggs,__pycache__,build,dist,venv,syft
max-complexity = 11
show-source = true
statistics = true
count = true
count = true
55 changes: 55 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Run tests

on:
push:
branches:
- dev
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.6]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
sudo apt-get update
hash -r
pip3 install -r requirements.txt > build.log
pip3 install flake8
pip3 install flake8-comprehensions
pip3 install pep8-naming
pip3 install -r dev-requirements.txt >> build.log

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined
# names
flake8 --config=.flake8 --exclude src/syft .
black --check --verbose --exclude src/syft .
# exit-zero treats all errors as warnings.
# diverting from the standard 79 character line length in
# accordance with this:
# https://www.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds
flake8 . --count --exit-zero --statistics --select=E,F,W,C90

- name: Test with pytest
run: |
coverage run -m pytest -v test

- name: Test documentation build
run: |
cd docs
make html
2 changes: 1 addition & 1 deletion app/websocket/app/main/events/control_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def connect_grid_nodes(message: dict) -> str:

if message["id"] not in local_worker._known_workers:
worker = NodeClient(
hook, address=message["address"], id=message["id"], credential=credentials,
hook, address=message["address"], id=message["id"], credential=credentials
)
return json.dumps({"status": "Succesfully connected."})

Expand Down
4 changes: 2 additions & 2 deletions app/websocket/app/main/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def show_status():
"""

connected_workers = filter(
lambda x: isinstance(x, NodeClient), local_worker._known_workers.values(),
lambda x: isinstance(x, NodeClient), local_worker._known_workers.values()
)
ids = map(lambda x: x.id, connected_workers)

Expand All @@ -115,7 +115,7 @@ def list_workers():
Response : List of node's ids.
"""
connected_workers = filter(
lambda x: isinstance(x, NodeClient), local_worker._known_workers.values(),
lambda x: isinstance(x, NodeClient), local_worker._known_workers.values()
)
ids = map(lambda x: x.id, connected_workers)
response_body = {RESPONSE_MSG.SUCCESS: True, "workers": list(ids)}
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ syft_proto
flask_cors
flask_login
redis
-e git+https://github.com/IonesioJunior/PySyft@add_grid_workers#egg=syft
aiounittest==1.3.1
-e git+https://github.com/OpenMined/PySyft@master#egg=syft

2 changes: 2 additions & 0 deletions test/test_api_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def test_connected_nodes(self):
for node_id in IDS:
self.assertTrue(node_id in response["grid-nodes"])

@pytest.mark.skip
def test_host_inference_encrypted_model_public_grid(self):
sy.hook.local_worker.is_client_worker = False

Expand Down Expand Up @@ -73,6 +74,7 @@ def forward(self, x):
assert th.all(result - expected.detach() < 1e-2)
sy.hook.local_worker.is_client_worker = True

@pytest.mark.skip
def test_host_inference_encrypted_model_private_grid(self):
sy.hook.local_worker.is_client_worker = False

Expand Down
2 changes: 2 additions & 0 deletions test/test_api_sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def forward(self, x):
hook.local_worker.is_client_worker = True


@pytest.mark.skip
def test_host_models_with_the_same_key(connected_node):
hook.local_worker.is_client_worker = False

Expand Down Expand Up @@ -135,6 +136,7 @@ def forward(self, x):
assert th.tensor(prediction) == th.tensor([1000.0])


@pytest.mark.skip
def test_delete_model(connected_node):
hook.local_worker.is_client_worker = False

Expand Down
4 changes: 2 additions & 2 deletions test/test_gateway_sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def test_get_protocol_join_scope(self):
async def test_protocol_id(self):
protocol_id = "not-fake-protocol-id"
response = await send_ws_message(
{"type": "get-protocol", "data": {"protocolId": protocol_id},}
{"type": "get-protocol", "data": {"protocolId": protocol_id}}
)

user = get_user(response)
Expand Down Expand Up @@ -178,6 +178,6 @@ async def test_webrtc_internal_message(self):

async def test_invalid_message_type(self):
response = await send_ws_message(
{"type": "not-a-type", "data": {"protocol-id": "test-protocol"},}
{"type": "not-a-type", "data": {"protocol-id": "test-protocol"}}
)
self.assertEqual(response, {"error": "Invalid JSON format/field!"})