Skip to content

Commit

Permalink
Some fixes for readthedocs build and CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Feb 20, 2021
1 parent 8fca61f commit da341d5
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Build

on:
push:
branches: [master, dev]
branches: [main, dev]
tags: ['v*']
pull_request:
branches: [master, dev]
branches: [main, dev]
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -59,8 +59,8 @@ jobs:
run: mypy .
- name: Run linter
run: flake8 aiohttp_client_cache
# - name: Generate code coverage report
# run: pytest --cov --cov-report=term --cov-report=html
- name: Generate code coverage report
run: pytest --cov --cov-report=term --cov-report=html
# - name: Send code coverage report to Coveralls
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ python:
path: .
extra_requirements:
- docs
- backends
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Caching behavior can be customized by defining various conditions:
* Specific request parameters
* Custom filter function

See [CacheBackend](https://aiohttp-client-cache.readthedocs.io/en/latest/modules/aiohttp_client_cache.backends.base.html)
See [CacheBackend](https://aiohttp-client-cache.readthedocs.io/en/latest/modules/aiohttp_client_cache.backends.base.html#aiohttp_client_cache.backends.base.CacheBackend)
docs for details.

## Credits
Expand Down
2 changes: 1 addition & 1 deletion aiohttp_client_cache/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class CacheBackend:
"""Base class for cache backends. This manages higher-level cache operations,
including cache expiration, generating cache keys, and managing redirect history.
including cache expiration, generating cache keys, and managing redirect history.
If instantiated directly, ``CacheBackend`` will use a non-persistent in-memory cache.
Expand Down
2 changes: 2 additions & 0 deletions aiohttp_client_cache/backends/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class DynamoDBBackend(CacheBackend):
See `DynamoDB Service Resource
<https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#service-resource>`_
for more usage details.
See :py:class:`.CacheBackend` for args.
"""

@extend_signature(CacheBackend.__init__)
Expand Down
5 changes: 5 additions & 0 deletions aiohttp_client_cache/backends/gridfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
class GridFSBackend(CacheBackend):
"""An async-compatible interface for caching objects in MongoDB GridFS.
Use this if you need to support documents greater than 16MB.
Args:
connection: Optional client object to use instead of creating a new one
See :py:class:`.CacheBackend` for additional args.
"""

@extend_signature(CacheBackend.__init__)
Expand Down
8 changes: 7 additions & 1 deletion aiohttp_client_cache/backends/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@


class MongoDBBackend(CacheBackend):
"""MongoDB cache backend"""
"""MongoDB cache backend
Args:
connection: Optional client object to use instead of creating a new one
See :py:class:`.CacheBackend` for additional args.
"""

@extend_signature(CacheBackend.__init__)
def __init__(self, cache_name: str = 'http-cache', connection: MongoClient = None, **kwargs):
Expand Down
5 changes: 4 additions & 1 deletion aiohttp_client_cache/backends/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@


class RedisBackend(CacheBackend):
"""Redis cache backend"""
"""Redis cache backend.
See :py:class:`.CacheBackend` for args.
"""

@extend_signature(CacheBackend.__init__)
def __init__(self, cache_name: str = 'http-cache', **kwargs):
Expand Down
2 changes: 2 additions & 0 deletions aiohttp_client_cache/backends/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class SQLiteBackend(CacheBackend):
Args:
cache_name: Database filename
See :py:class:`.CacheBackend` for additional args.
"""

@extend_signature(CacheBackend.__init__)
Expand Down
10 changes: 9 additions & 1 deletion test/test_session.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import pytest
from unittest.mock import AsyncMock, MagicMock, patch
import sys
from unittest.mock import MagicMock, patch

from aiohttp_client_cache.backends import CacheBackend
from aiohttp_client_cache.session import CachedSession, ClientSession

# AsyncMock was added in python 3.8
try:
from unittest.mock import AsyncMock
except ImportError:
pass
pytestmark = pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python 3.8 or higher")


@pytest.mark.asyncio
@patch.object(ClientSession, '_request')
Expand Down

0 comments on commit da341d5

Please sign in to comment.