mirror of
https://github.com/RustyRaptor/mal-scraper.git
synced 2026-12-03 15:35:18 -07:00
Minor improvements for dev and to docs
This commit is contained in:
1 parent
74934101c3
commit
18dbbed6cc
7 files changed
+34
-12
No files matched your search
@@ -10,6 +10,7 @@ insert_final_newline = true
|
||||
[*.py]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
max_line_length = 100
|
||||
|
||||
[*.{bat,cmd,ps1}]
|
||||
end_of_line = crlf
|
||||
@@ -37,6 +37,8 @@ Development
|
||||
|
||||
To set up `mal-scraper` for local development:
|
||||
|
||||
We respect `.editorconfig <http://editorconfig.org/>`.
|
||||
|
||||
1. Fork `mal-scraper <https://github.com/QasimK/mal-scraper>`_
|
||||
(look for the "Fork" button).
|
||||
2. Clone your fork locally::
|
||||
@@ -53,6 +55,8 @@ To set up `mal-scraper` for local development:
|
||||
|
||||
tox
|
||||
|
||||
The newly built HTML docs can be found within the dist folder in the repo.
|
||||
|
||||
5. Commit your changes and push your branch to GitHub::
|
||||
|
||||
git add .
|
||||
@@ -81,10 +85,18 @@ For merging, you should:
|
||||
Tips
|
||||
----
|
||||
|
||||
To run the test-suite quickly::
|
||||
|
||||
pytest
|
||||
|
||||
To run a subset of tests::
|
||||
|
||||
tox -e envname -- py.test -k test_myfeature
|
||||
|
||||
To skip Python environments that you do not have installed::
|
||||
|
||||
tox --skip-missing-interpreters
|
||||
|
||||
To run all the test environments in *parallel* (you need to ``pip install detox``)::
|
||||
|
||||
detox
|
||||
+13
-7
@@ -59,26 +59,32 @@ Overview
|
||||
Usage
|
||||
=====
|
||||
|
||||
Use the [online documentation](https://mal-scraper.readthedocs.io/), and just::
|
||||
Use the `online documentation <https://mal-scraper.readthedocs.io/>`, and just::
|
||||
|
||||
pip install mal-scraper
|
||||
|
||||
We follow `Semantic Versioning <http://semver.org/>`.
|
||||
|
||||
|
||||
Development
|
||||
===========
|
||||
|
||||
Please see the Contributing documentation page for full details, and especially
|
||||
look at the tips section there.
|
||||
|
||||
After cloning, and creating a virtualenv, install the development dependencies::
|
||||
|
||||
pip install -e .[develop]
|
||||
|
||||
You should install Python interpreters 3.4, and 3.5 because tox will test on all of them. (Hints: `Linux <https://askubuntu.com/questions/125342/how-can-i-install-python-2-6-on-12-04>`_.)
|
||||
To run the all tests, skipping the python interpreters you don't have::
|
||||
|
||||
To run the all tests run::
|
||||
tox --skip-missing-interpreters
|
||||
|
||||
tox
|
||||
|
||||
- Tests will always mock requests to the internet. You can set the environment variable :code:`LIVE_RESPONSES=1` to properly test web scraping.
|
||||
- Run tests faster using just :code:`py.test` (useful for intermediate development). However, tox must be run as it also tests documentation, additional style linting etc.
|
||||
- Tests will always mock requests to the internet. You can set the environment
|
||||
variable :code:`LIVE_RESPONSES=1` to properly test web scraping.
|
||||
- Run tests faster using just :code:`py.test` (useful for intermediate
|
||||
development). However, tox must be run as it also tests documentation,
|
||||
additional style linting etc.
|
||||
- You can look at coverage results inside `htmlcov/index.html`.
|
||||
|
||||
Note, to combine the coverage data from all the tox environments run:
|
||||
|
||||
@@ -5,7 +5,7 @@ universal = 1
|
||||
max-line-length = 100
|
||||
max-complexity = 8
|
||||
|
||||
[pytest]
|
||||
[tool:pytest]
|
||||
testpaths =
|
||||
tests
|
||||
docs
|
||||
|
||||
@@ -25,6 +25,7 @@ requirements = [
|
||||
|
||||
test_requirements = [
|
||||
'tox',
|
||||
'pytest',
|
||||
'responses >=0, <1',
|
||||
]
|
||||
|
||||
|
||||
@@ -112,7 +112,8 @@ class TestUserStats(object):
|
||||
mock_requests.always_mock(self.TEST_LAST_ONLINE_DATE_PAGE, 'user_last_online_date')
|
||||
|
||||
_, info = mal_scraper.get_user_stats(self.TEST_LAST_ONLINE_DATE_USER)
|
||||
assert datetime(year=2016, month=10, day=1, hour=4, minute=29) == info['last_online']
|
||||
this_year = datetime.utcnow().year
|
||||
assert datetime(year=this_year, month=10, day=1, hour=4, minute=29) == info['last_online']
|
||||
|
||||
|
||||
class TestUserAnimeList(object):
|
||||
|
||||
@@ -4,16 +4,17 @@
|
||||
envlist =
|
||||
clean,
|
||||
check,
|
||||
{py34,py35},
|
||||
{py34,py35,py36},
|
||||
report,
|
||||
docs
|
||||
|
||||
[testenv]
|
||||
basepython =
|
||||
{docs,spell}: {env:TOXPYTHON:python3.4}
|
||||
{docs,spell}: {env:TOXPYTHON:python3}
|
||||
py34: {env:TOXPYTHON:python3.4}
|
||||
py35: {env:TOXPYTHON:python3.5}
|
||||
{clean,check,report,coveralls,codecov}: python3.5
|
||||
py36: {env:TOXPYTHON:python3.6}
|
||||
{clean,check,report,coveralls,codecov}: python3
|
||||
bootstrap: python
|
||||
setenv =
|
||||
PYTHONPATH={toxinidir}/tests
|
||||
|
||||
Reference in new issue
Block a user