Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests run improvements: update from python setup.py test -> tox #754

Merged
merged 2 commits into from
Aug 31, 2022
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
25 changes: 18 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,36 @@ The 2.x release included a major overhaul of pywb and introduces many new featur
Please see the `full documentation <https://pywb.readthedocs.org>`_ for more detailed info on all these features.


Installation
------------
Installation for Deployment
---------------------------

To install pywb for usage, you can use:

```shell
pip install pywb
```

Note: depending on your Python installation, you may have to use `pip3` instead of `pip`.

To install, test and build docs locally you can:

* Install with ``python setup.py install``
Installation from local copy
----------------------------

```shell
git clone https://github.com/webrecorder/pywb
```

To install from a locally cloned copy, install with ``pip install -e .`` or ``python setup.py install``.

To run tests, we recommend installing ``pip install tox tox-current-env`` and then running ``tox --current-env`` to test in your current Python environment.

* Run tests with ``python setup.py test``
To Build docs locally, run: ``cd docs; make html``. (The docs will be built in ``./_build/html/index.html``)

* Run Wayback with ``wayback`` (see docs for info on how to setup collections)

* Build docs locally with: ``cd docs; make html``. (The docs will be built in ``./_build/html/index.html``)
Running
-------

After installation, you can run ``pywb`` or ``wayback``.

Consult the local or `online docs <https://pywb.readthedocs.org>`_ for latest usage and configuration details.

Expand Down
12 changes: 8 additions & 4 deletions pywb/manager/locmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
import os.path
import shutil

from babel.messages.frontend import CommandLineInterface

from translate.convert.po2csv import main as po2csv
from translate.convert.csv2po import main as csv2po
try:
from babel.messages.frontend import CommandLineInterface

from translate.convert.po2csv import main as po2csv
from translate.convert.csv2po import main as csv2po
loc_avail = True
except:
loc_avail = False


ROOT_DIR = 'i18n'
Expand Down
7 changes: 1 addition & 6 deletions pywb/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,7 @@ def do_acl(r):
acl.set_defaults(func=do_acl)

# LOC
loc_avail = False
try:
from pywb.manager.locmanager import LocManager
loc_avail = True
except:
pass
from pywb.manager.locmanager import LocManager, loc_avail

def do_loc(r):
if not loc_avail:
Expand Down
12 changes: 1 addition & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,7 @@ def get_package_data():
"translate_toolkit"
],
},
tests_require=[
'pytest',
'WebTest',
'pytest-cov',
'mock',
'urllib3',
'werkzeug',
'httpbin==0.5.0',
'ujson',
'lxml'
],
tests_require=load_requirements("test_requirements.txt"),
cmdclass={'test': PyTest},
test_suite='',
entry_points="""
Expand Down
9 changes: 9 additions & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pytest
WebTest
pytest-cov
mock
urllib3
httpbin==0.5.0
flask<2.0
ujson
lxml
3 changes: 3 additions & 0 deletions tests/test_locales.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from .base_config_test import BaseConfigTest
import pytest


# ============================================================================
class TestLocales(BaseConfigTest):
@classmethod
def setup_class(cls):
super(TestLocales, cls).setup_class('config_test_loc.yaml')
pytest.importorskip('babel')
pytest.importorskip('translate_toolkit')

def test_locale_en_home(self):
res = self.testapp.get('/en/')
Expand Down
15 changes: 3 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,19 @@ testpaths =
tests

[tox]
envlist = py36, py37, py38, py39
envlist = py36, py37, py38, py39, py310

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
3.10: py39

[testenv]
deps =
pytest
pytest-cov
coverage
WebTest
fakeredis<1.0
mock
urllib3
werkzeug
httpbin==0.5.0
ujson
lxml
-rtest_requirements.txt
-rrequirements.txt
-rextra_requirements.txt
commands =
Expand Down