diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index fc248a7..4dfeb09 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python 3.9 - uses: actions/setup-python@v1 + uses: actions/setup-python@v2.2.1 with: python-version: 3.9 - name: Install pypa/build diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index e71a49f..a2bcabb 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: 3.9 - name: Install dependencies @@ -39,7 +39,7 @@ jobs: clean: false fetch-depth: 20 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: 3.9 - name: Install dependencies diff --git a/.github/workflows/run_tests_matrix.yml b/.github/workflows/run_tests_matrix.yml index 77a32c8..6def964 100644 --- a/.github/workflows/run_tests_matrix.yml +++ b/.github/workflows/run_tests_matrix.yml @@ -5,6 +5,9 @@ on: workflow_dispatch: push: branches: [ develop, master, release/** ] + # Runs a schedule to keep the cache fresh, caches last 7 days. + schedule: + - cron: "0 4 * * 6" jobs: build-matrix: @@ -19,13 +22,19 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: ${{ matrix.python-version }} + - name: Cache pip dependancies for python version + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pyv${{ matrix.python-version }}-dv${{ matrix.discordpy-version }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pyv${{ matrix.python-version }}-dv${{ matrix.discordpy-version }}pip- - name: Install dependencies, discord.py version ${{ matrix.discordpy-version }} run: | python -m pip install --upgrade pip - pip install -r requirements.txt pip install discord.py==${{ matrix.discordpy-version }} pip install . @@ -46,7 +55,7 @@ jobs: clean: false fetch-depth: 20 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: 3.9 - name: Install dependencies @@ -65,7 +74,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python 3.9 - uses: actions/setup-python@v1 + uses: actions/setup-python@v2.2.1 with: python-version: 3.9 - name: Install pypa/build diff --git a/README.md b/README.md index 3418f66..03b4dec 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # Distest -[![CodeFactor](https://www.codefactor.io/repository/github/jakecover/distest/badge/?style=flat-square)](https://www.codefactor.io/repository/github/jakecover/distest/overview/?style=flat-square) -[![Build Status](https://img.shields.io/travis/JakeCover/distest/develop.svg?style=flat-square)](https://travis-ci.org/JakeCover/distest) -[![PyPi Version](https://img.shields.io/pypi/v/distest.svg?style=flat-square)](https://pypi.org/project/distest) +[![CodeFactor](https://www.codefactor.io/repository/github/jakecover/distest/badge/)](https://www.codefactor.io/repository/github/jakecover/distest/overview/?style=flat-square) +[![PyPi Version](https://img.shields.io/pypi/v/distest.svg)](https://pypi.org/project/distest) +![PyPI - Downloads](https://img.shields.io/pypi/dm/distest) [![Discord Server](https://img.shields.io/discord/523301176309972993.svg?label=Discord)](https://discord.gg/Dah7RHH) +[![Run Tests Matrix](https://github.com/JakeCover/distest/actions/workflows/run_tests_matrix.yml/badge.svg?branch=master)](https://github.com/JakeCover/distest/actions/workflows/run_tests_matrix.yml) A small library used to write automated test for Discord bots. diff --git a/__about__.py b/__about__.py index 43c4ab0..22049ab 100644 --- a/__about__.py +++ b/__about__.py @@ -1 +1 @@ -__version__ = "0.6.1" +__version__ = "0.6.2" diff --git a/distest/bot.py b/distest/bot.py index 1b617f8..e1467bf 100644 --- a/distest/bot.py +++ b/distest/bot.py @@ -49,6 +49,9 @@ def _find_target(self, server: discord.Guild) -> discord.Member: to look for the target user in :rtype: discord.Member """ + if self.user.id == self._target_name: + print("The tester cannot run tests on itself. Make sure your target id is set correctly.") + raise Exception("Cannot run tests on self.") for member in server.members: if self._target_name == member.id: if member.status == discord.Status.offline: diff --git a/requirements.txt b/requirements.txt index 5e60516..b1c9443 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ discord.py~=1.6.0 -Sphinx~=3.4.0 +Sphinx~=3.5.3 black==20.8b1 -furo==2020.12.30b24 \ No newline at end of file +furo==2021.3.20b30 \ No newline at end of file