Skip to content

Commit

Permalink
Rename speed.py to speedtest.py and make test_speed() more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
cryzed committed Feb 2, 2020
1 parent b7e1120 commit 77ad97c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion traffictoll/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ruamel.yaml import YAML

from .net import ProcessFilterPredicate, filter_net_connections
from .speed import test_speed
from .speedtest import test_speed
from .tc import (
MAX_RATE,
INGRESS_QDISC_PARENT_ID,
Expand Down
12 changes: 8 additions & 4 deletions traffictoll/speed.py → traffictoll/speedtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import subprocess
from typing import Tuple, Optional

from traffictoll.utils import run
from .exceptions import DependencyError
from .utils import run


# https://www.speedtest.net/apps/cli
Expand Down Expand Up @@ -30,9 +31,12 @@ def _sivel_speedtest_cli() -> Optional[Tuple[int, int]]:


def test_speed() -> Optional[Tuple[int, int]]:
process = run(
"speedtest --version", stdout=subprocess.PIPE, universal_newlines=True
)
try:
process = run(
"speedtest --version", stdout=subprocess.PIPE, universal_newlines=True
)
except DependencyError:
return

lines = process.stdout.splitlines()
if not lines:
Expand Down

0 comments on commit 77ad97c

Please sign in to comment.