Skip to content

Commit

Permalink
Merge pull request #93 from nocarryr/test-expansion
Browse files Browse the repository at this point in the history
Python version test expansion
  • Loading branch information
nocarryr committed Dec 15, 2018
2 parents 2866b03 + 6b0fd21 commit 1a19e5a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 15 deletions.
37 changes: 27 additions & 10 deletions .travis.yml
@@ -1,10 +1,27 @@
language: python
sudo: required
dist: trusty
python:
- "2.7"
- "3.4"
- "3.5.2"
dist: xenial
matrix:
include:
- python: "2.7"
env:
- ALLOW_DOC_DEPLOY=false
- ALLOW_PYPI_DEPLOY=false
- python: "3.4"
env:
- ALLOW_DOC_DEPLOY=false
- ALLOW_PYPI_DEPLOY=false
- python: "3.5"
env:
- ALLOW_DOC_DEPLOY=false
- ALLOW_PYPI_DEPLOY=false
- python: "3.6"
env:
- ALLOW_DOC_DEPLOY=true
- ALLOW_PYPI_DEPLOY=true
- python: "3.7"
env:
- ALLOW_DOC_DEPLOY=false
- ALLOW_PYPI_DEPLOY=false
addons:
apt:
packages:
Expand All @@ -17,20 +34,20 @@ before_install:
install:
- pip install -U pip setuptools wheel
- pip install -U pytest pytest-xdist pytest-cov coveralls
- sh -c "if [ '$TRAVIS_PYTHON_VERSION' = '3.5.2' ]; then pip install -r doc/requirements.txt; fi"
- sh -c "if [ '$ALLOW_DOC_DEPLOY' = 'true' ]; then pip install -r doc/requirements.txt; fi"
- pip install -e .
script:
- sh -c "if [ '$TRAVIS_PYTHON_VERSION' = '3.5.2' ]; then travis-sphinx build --source=doc/source --nowarn; fi"
- sh -c "if [ '$ALLOW_DOC_DEPLOY' = 'true' ]; then travis-sphinx build --source=doc/source --nowarn; fi"
- py.test --cov-append --cov-config .coveragerc --cov=rtlsdr
- py.test --cov-append --cov-config .coveragerc --cov=rtlsdr --boxed --no-overrides --pyargs tests/no_override*
after_success:
- coveralls
- sh -c "if [ '$TRAVIS_PYTHON_VERSION' = '3.5.2' ]; then travis-sphinx deploy; fi"
- sh -c "if [ '$ALLOW_DOC_DEPLOY' = 'true' ]; then travis-sphinx deploy; fi"
deploy:
provider: pypi
distributions: "sdist bdist_wheel"
on:
python: "3.5.2"
condition: $ALLOW_PYPI_DEPLOY = true
tags: true
user: nocarryr
password:
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Expand Up @@ -64,6 +64,8 @@ def read_rst():
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Utilities'],
license='GPLv3',
keywords='radio librtlsdr rtlsdr sdr',
Expand Down
15 changes: 10 additions & 5 deletions tests/utils.py
Expand Up @@ -14,32 +14,37 @@

def iter_test_samples(num_samples=None):
count = 0
while True:
complete = False
while not complete:
for i, q in zip(range(256), range(255, -1, -1)):
yield i, q
if num_samples is not None:
count += 1
if count >= num_samples:
raise StopIteration()
complete = True
break

def iter_test_bytes(num_bytes=None):
count = 0
if num_bytes is not None:
num_samples = num_bytes // 2
else:
num_samples = None
while True:
complete = False
while not complete:
for i, q in iter_test_samples(num_samples):
yield i
if num_bytes is not None:
count += 1
if count >= num_bytes:
raise StopIteration()
complete = True
break
yield q
if num_bytes is not None:
count += 1
if count >= num_bytes:
raise StopIteration()
complete = True
break

def check_generated_data(samples, direct_sampling=0, use_numpy=True):
if not is_travisci():
Expand Down

0 comments on commit 1a19e5a

Please sign in to comment.