upgraded testing methods, dev dependencies, and travis config

This commit is contained in:
Brian Muller 2018-01-01 17:07:40 -05:00
parent a6e50acd84
commit 65dc646e98
10 changed files with 58 additions and 31 deletions

View File

@ -1,6 +1,6 @@
language: python
python:
- "2.7"
- "pypy"
install: pip install . --use-mirrors && pip install pep8 pyflakes
script: make test
- "3.5"
- "3.6"
install: pip install . && pip install -r dev-requirements.txt
script: python -m unittest

View File

@ -1,4 +1,4 @@
Copyright (c) 2014 Brian Muller
Copyright (c) 2018 Brian Muller
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@ -1,11 +0,0 @@
PYDOCTOR=pydoctor
test: lint
trial kademlia
lint:
pep8 --ignore=E303,E251,E201,E202 ./kademlia --max-line-length=140
find ./kademlia -name '*.py' | xargs pyflakes
install:
python setup.py install

View File

@ -63,5 +63,24 @@ To run tests:
trial kademlia
```
## Logging
This library uses the standard [Python logging library](https://docs.python.org/3/library/logging.html). To see debut output printed to STDOUT, for instance, use:
```python
import logging
log = logging.getLogger('rpcudp')
log.setLevel(logging.DEBUG)
log.addHandler(logging.StreamHandler())
```
## Running Tests
To run tests:
```
pip install -r dev-requirements.txt
python -m unittest
```
## Fidelity to Original Paper
The current implementation should be an accurate implementation of all aspects of the paper save one - in Section 2.3 there is the requirement that the original publisher of a key/value republish it every 24 hours. This library does not do this (though you can easily do this manually).

5
dev-requirements.txt Normal file
View File

@ -0,0 +1,5 @@
pycodestyle==2.3.1
pylint==1.8.1
sphinx>=1.6.5
sphinxcontrib-napoleon>=0.6.1
sphinxcontrib-zopeext>=0.2.1

0
docs/_static/.gitkeep vendored Normal file
View File

View File

@ -50,7 +50,7 @@ master_doc = 'index'
# General information about the project.
project = u'Kademlia'
copyright = u'2015, Brian Muller'
copyright = u'2018, Brian Muller'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@ -59,7 +59,7 @@ copyright = u'2015, Brian Muller'
# The short X.Y version.
sys.path.insert(0, os.path.abspath('..'))
import kademlia
version = kademlia.version
version = kademlia.__version__
# The full version, including alpha/beta/rc tags.
release = version

View File

@ -1,5 +0,0 @@
twisted>=14.0
rpcudp>=1.0
sphinxcontrib-napoleon>=0.2.8
sphinx==1.2.3
sphinxcontrib-zopeext>=0.2.1

View File

@ -11,14 +11,6 @@ kademlia.crawling module
:undoc-members:
:show-inheritance:
kademlia.log module
-------------------
.. automodule:: kademlia.log
:members:
:undoc-members:
:show-inheritance:
kademlia.network module
-----------------------

View File

@ -0,0 +1,27 @@
import unittest
from glob import glob
import pycodestyle
from pylint import epylint as lint
class LintError(Exception):
pass
class TestCodeLinting(unittest.TestCase):
# pylint: disable=no-self-use
def test_pylint(self):
(stdout, _) = lint.py_run('kademlia', return_std=True)
errors = stdout.read()
if errors.strip():
raise LintError(errors)
# pylint: disable=no-self-use
def test_pep8(self):
style = pycodestyle.StyleGuide()
files = glob('kademlia/**/*.py', recursive=True)
result = style.check_files(files)
if result.total_errors > 0:
raise LintError("Code style errors found.")