Skip to content

Commit

Permalink
Dynamically include vcrpy requirement if installing in GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
LilSpazJoekp committed Jun 4, 2022
1 parent dbcb081 commit e3cdb7c
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 29 deletions.
10 changes: 0 additions & 10 deletions .github/CONTRIBUTING.rst
Expand Up @@ -48,16 +48,6 @@ Creating Pull Requests
as a unit test. Tests that hit Reddit's servers will be an integration test and all
network activity will be recorded via vcrpy. The required packages can be installed
with ``pip install asyncpraw[test]``.

.. note::

Async PRAW uses a fork of `vcrpy` before you can run tests locally you must
install the forked version.

.. code-block:: bash
pip install https://github.com/LilSpazJoekp/vcrpy/archive/asyncpraw.zip
7. Feel free to check on the status of your pull request periodically by adding a
comment.

Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Expand Up @@ -52,7 +52,6 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install https://github.com/LilSpazJoekp/vcrpy/archive/asyncpraw.zip
pip install .[test]
- name: Test with pytest
run: pytest
Expand All @@ -77,9 +76,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install https://github.com/LilSpazJoekp/vcrpy/archive/asyncpraw.zip
pip install .[test]
pip install .[ci]
pip install .[ci,test]
- name: Test with pytest
run: coverage run --source asyncpraw --module pytest
- env:
Expand Down Expand Up @@ -110,7 +107,6 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install https://github.com/LilSpazJoekp/vcrpy/archive/asyncpraw.zip
pip install .[test]
- name: Run network test
run: pytest tests/integration/test_github_actions.py::test_github_actions
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/python-publish.yml
Expand Up @@ -12,6 +12,7 @@ jobs:
python -m pip install --upgrade pip
pip install setuptools wheel twine
- env:
PYPI_UPLOAD: true
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
name: Build and release
Expand Down
9 changes: 0 additions & 9 deletions docs/package_info/contributing.rst
Expand Up @@ -67,15 +67,6 @@ tests locally. The simplest way is via:
Without any configuration or modification, all the tests should pass. If they do not,
please file a bug report.

.. note::

Async PRAW uses a fork of `vcrpy` before you can run tests locally you must install
the forked version.

.. code-block:: bash
pip install https://github.com/LilSpazJoekp/vcrpy/archive/asyncpraw.zip
Adding and Updating Integration Tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
6 changes: 4 additions & 2 deletions setup.py
@@ -1,5 +1,5 @@
"""asyncpraw setup.py"""

import os
import re
from codecs import open
from os import path
Expand Down Expand Up @@ -30,7 +30,9 @@
"pytest-asyncio",
"pytest-vcr",
"testfixtures >4.13.2, <7",
"vcrpy==4.1.1",
"vcrpy >=4.1.1"
if os.getenv("PYPI_UPLOAD", False)
else "vcrpy@git+https://github.com/kevin1024/vcrpy.git@b1bc5c3a02db0447c28ab9a4cee314aeb6cdf1a7",
],
}
extras["dev"] += extras["lint"] + extras["test"]
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/__init__.py
@@ -1,4 +1,4 @@
"""PRAW Integration test suite."""
"""Async PRAW Integration test suite."""
import inspect
import logging

Expand All @@ -11,7 +11,7 @@


class IntegrationTest(asynctest.TestCase):
"""Base class for PRAW integration tests."""
"""Base class for Async PRAW integration tests."""

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/reddit/test_redditor.py
Expand Up @@ -67,7 +67,7 @@ async def test_message(self, _):
self.reddit.read_only = False
with self.use_cassette():
redditor = await self.reddit.redditor("subreddit_stats")
await redditor.message("Async PRAW test", "This is a test fromAsync PRAW")
await redditor.message("Async PRAW test", "This is a test from Async PRAW")

@mock.patch("asyncio.sleep", return_value=None)
async def test_message_from_subreddit(self, _):
Expand Down

0 comments on commit e3cdb7c

Please sign in to comment.