diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 5cc5fcf..4387bb1 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -14,26 +14,43 @@ env: TEST_URL: ${{secrets.TEST_URL}} TEST_SLACK_URL: ${{secrets.TEST_SLACK_URL}} TEST_WEBEX_URL: ${{secrets.TEST_WEBEX_URL}} + TEST_DISCORD_URL: ${{secrets.TEST_DISCORD_URL}} jobs: test: runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-2019, windows-2022, windows-latest, ubuntu-latest] + include: + # Python 3.9 is the primary dev version + - os: windows-2022 + python-version: '3.9' + - os: windows-latest + python-version: '3.9' + - os: ubuntu-latest + python-version: '3.9' + # Python 3.6 is the minimum supported version + - os: windows-2022 + python-version: '3.6' + # github actions does not support any other runners with python 3.6 + # Python 3.14 is the latest (Oct 14th 2025) version + - os: windows-latest + python-version: '3.14' + - os: ubuntu-latest + python-version: '3.14' environment: test steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: ${{ matrix.python-version }} - name: Install Tox run: pip install tox - name: Run tests run: tox - + diff --git a/pyproject.toml b/pyproject.toml index 8eff242..66e593e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "whecho" -version = "0.0.5" +version = "0.0.6" description = "Linux echo with webhooks! ⚓" readme = "README.md" authors = [ @@ -30,6 +30,7 @@ python = ">=3.6" requests = ">=2.25.1" setuptools = ">=40.6.3" toml = ">=0.6.0" +importlib-metadata = {version = ">=1.0", python = "<3.8"} [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/tests/test_whecho_simple.py b/tests/test_whecho_simple.py index 10246e5..479e40c 100644 --- a/tests/test_whecho_simple.py +++ b/tests/test_whecho_simple.py @@ -44,9 +44,15 @@ def test_simple_slack(): def test_simple_webex(): # test webex url with python function simple_post('TEST_WEBEX_URL', False) + +def test_simple_discord(): + # test discord url with python function + simple_post('TEST_DISCORD_URL', False) if __name__ == "__main__": simple_post() # only test discord with main function (duplicated in test_auto_machine.py) test_simple_slack() test_simple_webex() + test_simple_discord() + \ No newline at end of file diff --git a/tox.ini b/tox.ini index 9f0560e..a616d3b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,16 @@ [tox] -envlist = py39 +envlist = py +isolated_build = true [testenv] +skip_missing_interpreters = true +setenv = + PYTHONIOENCODING = utf-8 passenv = TEST_URL TEST_SLACK_URL TEST_WEBEX_URL + TEST_DISCORD_URL deps = pytest toml diff --git a/whecho/_config.py b/whecho/_config.py index 52a3bde..7d4ff4b 100644 --- a/whecho/_config.py +++ b/whecho/_config.py @@ -2,7 +2,10 @@ import os import getpass -import pkg_resources +try: # python >= 3.8 + import importlib.metadata as metadata +except ImportError: # python < 3.8 + import importlib_metadata as metadata import toml import socket import platform @@ -13,7 +16,7 @@ except Exception: config_username = "user" DEFAULT_CONFIG = {'default_url': None, - 'version': pkg_resources.get_distribution('whecho').version, + 'version': metadata.version('whecho'), 'user': config_username, 'os': platform.system(), 'machine': "auto",} diff --git a/whecho/_send_message.py b/whecho/_send_message.py index b60a0f9..2aa071f 100644 --- a/whecho/_send_message.py +++ b/whecho/_send_message.py @@ -27,6 +27,7 @@ def post_simple(message, url, conf=None, debug=False): def get_data(conf,message,url,debug=False): """General get data function for all supported webhooks.""" url_keyword_map = {"discord.com": get_discord_data, + "discordapp.com": get_discord_data, "slack.com": get_slack_data, "webhook.office.com": get_teams_data, "webexapis.com": get_webex_data} diff --git a/whecho/_utilities.py b/whecho/_utilities.py index 20a4b3d..62d0652 100644 --- a/whecho/_utilities.py +++ b/whecho/_utilities.py @@ -1,6 +1,9 @@ # Contains utility functions for the whecho project. -import pkg_resources +try: # python >= 3.8 + import importlib.metadata as metadata +except ImportError: # python < 3.8 + import importlib_metadata as metadata import os from whecho import _config as config import toml @@ -8,7 +11,7 @@ def get_version(): """Prints the version of whecho and exits.""" - print(pkg_resources.get_distribution('whecho').version) + print(metadata.version('whecho')) exit(0) def init():