diff --git a/.travis.yml b/.travis.yml index 89b78b3b..af952652 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,8 @@ install: #script: py.test run-tests.py ./pywb/ --doctest-modules --ignore=setup.py #script: py.test -v --doctest-module ./tests/*.py ./pywb/ script: - py.test --cov-config .coveragerc --cov pywb -v --doctest-module ./pywb/ tests/ + #py.test --cov-config .coveragerc --cov pywb -v --doctest-module ./pywb/ tests/ + python setup.py test after_success: coveralls diff --git a/README.md b/README.md index 8b486c7d..5c38537b 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,13 @@ At its core, it provides a web app which 'replays' archived web data stored in A captures. +### Latest Changes ### + The basic feature set of web replay is nearly complete. -pywb features new domain specific rules which can be applied to certain difficult and dynamic content in order to make -web replay work. +pywb now features new [domain-specific rules](pywb/rules.yaml) which are applied to certain difficult and dynamic content in order to make web replay work. -The rules set will be under constant iteration to deal with new challenges as the web evoles. +This rules set will be under constant iteration to deal with new challenges as the web evoles. ### Wayback Machine @@ -55,11 +56,20 @@ Support for Python 3 is planned. pywb comes with a a set of sample archived content, also used by the test suite. -The data can be found in `sample_archive` and contains -`warc` and `cdx` files. The sample archive contains -recent captures from `http://example.com` and `http://iana.org` +The data can be found in `sample_archive` and contains `warc` and `cdx` files. -### Installation +The sample archive contains recent captures from `http://example.com` and `http://iana.org` + +### Runnable Apps + +The pywb tool suite currently includes two runnable applications in the `pywb.apps` package: + +* `python -m pywb.apps.wayback` -- start the full wayback on port 8080 + +* `python -m pywb.apps.cdx_server` -- start standalone cdx server on port 8090 + + +### Step-By-Step Installation To start a pywb with sample data: @@ -114,9 +124,9 @@ spawned uWSGI worker 1 (and the only) (pid: 123, cores: 1) At this point, you can open a web browser and navigate to the examples above for testing. -### Automated Tests +### Test Suite -Currently pywb includes a full (and growing) suite of tests. +Currently pywb includes a full (and growing) suite of unit doctest and integration tests. Top level integration tests can be found in the `tests/` directory, and each subpackage also contains doctests and unit tests. @@ -124,10 +134,12 @@ and each subpackage also contains doctests and unit tests. The full set of tests can be run by executing: -`python run-tests.py` +`python setup.py test` which will run the tests using py.test. +The py.test coverage plugin is used to keep track of test coverage. + ### Sample Setup @@ -157,8 +169,8 @@ For more advanced use, the pywb init path can be customized further: * The `PYWB_CONFIG_FILE` env can be used to set a different yaml file. -* Custom init app (with or without yaml) can be created. See [bin/wayback.py] and [pywb/core/pywb_init.py] for examples - of boot strapping. +* Custom init app (with or without yaml) can be created. See [wayback.py](pywb/apps/wayback.py) and [pywb_init.py](pywb/core/pywb_init.py) for examples + of existing initialization paths. ### Configuring PyWb With Archived Data diff --git a/setup.py b/setup.py index 910a3923..33356739 100755 --- a/setup.py +++ b/setup.py @@ -2,15 +2,41 @@ # vim: set sw=4 et: from setuptools import setup, find_packages +from setuptools.command.test import test as TestCommand import glob + +# Fix for TypeError: 'NoneType' object is not callable" error +# when running 'python setup.py test' +try: + import multiprocessing +except ImportError: + pass + + +long_description = open('README.md').read() + + +class PyTest(TestCommand): + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_suite = True + + def run_tests(self): + import pytest + import sys + cmdline = ' --cov-config .coveragerc --cov pywb' + cmdline += ' -v --doctest-module ./pywb/ tests/' + errcode = pytest.main(cmdline) + sys.exit(errcode) + setup( name='pywb', version='0.2', url='https://github.com/ikreymer/pywb', author='Ilya Kreymer', author_email='ilya@archive.org', - long_description=open('README.md').read(), + long_description=long_description, license='GPL', packages=find_packages(), provides=[ @@ -27,11 +53,12 @@ setup( package_data={ 'pywb': ['ui/*', 'static/*', '*.yaml'], }, - data_files = [ + data_files=[ ('sample_archive/cdx/', glob.glob('sample_archive/cdx/*')), ('sample_archive/zipcdx/', glob.glob('sample_archive/zipcdx/*')), ('sample_archive/warcs/', glob.glob('sample_archive/warcs/*')), - ('sample_archive/text_content/', glob.glob('sample_archive/text_content/*')), + ('sample_archive/text_content/', + glob.glob('sample_archive/text_content/*')), ], install_requires=[ 'rfc3987', @@ -40,9 +67,12 @@ setup( 'jinja2', 'surt', 'pyyaml', + ], + tests_require=[ 'WebTest', 'pytest', - ], - # tests_require=['WebTest', 'pytest'], - zip_safe=False + 'pytest-cov', + ], + cmdclass={'test': PyTest}, + test_suite='', )