mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-02 22:53:40 +00:00
2a945de069
GitHub pytest runner stalling with the following error: [Errno 2] No such file or directory: '/opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/deluge/plugins' This is related to the editable install of Deluge via pip pip install -e . and the custom resource_filename in deluge.common is the source of the problem where a DistInfoDistribution returns a different path to EggInfoDistribution. Working egg-info install >>> pkg_resources.get_distribution('Deluge') deluge 2.1.1.dev8 (/home/user/deluge) >>> type(pkg_resources.get_distribution('Deluge')) <class 'pkg_resources.EggInfoDistribution'> >>> pkg_resources.resource_filename('deluge', 'plugins') '/home/user/deluge/deluge/plugins' This can identified by the `deluge.egg-info` directory in source directory. Broken dist-info install >>> pkg_resources.get_distribution('Deluge') deluge 2.1.1.dev8 (/opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages) >>> type(pkg_resources.get_distribution('Deluge')) <class 'pkg_resources.DistInfoDistribution'> >>> pkg_resources.resource_filename('deluge', 'plugins') '/home/user/deluge/deluge/plugins' This can be worked around by setting an env var that enables legacy mode but long-term need to replace the custom resource_filename and replace usage of pkg_resources. https://setuptools.pypa.io/en/latest/userguide/development_mode.html#legacy-behavior https://setuptools.pypa.io/en/latest/pkg_resources.html
99 lines
3.0 KiB
YAML
99 lines
3.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
|
|
|
|
jobs:
|
|
test-linux:
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.7", "3.10"]
|
|
|
|
steps:
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: "pip"
|
|
cache-dependency-path: "requirements*.txt"
|
|
|
|
- name: Sets env var for security
|
|
if: (github.event_name == 'pull_request' && contains(github.event.pull_request.body, 'security_test')) || (github.event_name == 'push' && contains(github.event.head_commit.message, 'security_test'))
|
|
run: echo "SECURITY_TESTS=True" >> $GITHUB_ENV
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install --upgrade pip wheel
|
|
pip install -r requirements.txt -r requirements-tests.txt
|
|
pip install -e .
|
|
|
|
- name: Install security dependencies
|
|
if: contains(env.SECURITY_TESTS, 'True')
|
|
run: |
|
|
wget -O- $TESTSSL_URL$TESTSSL_VER | tar xz
|
|
mv -t deluge/tests/data testssl.sh-$TESTSSL_VER/testssl.sh testssl.sh-$TESTSSL_VER/etc/;
|
|
env:
|
|
TESTSSL_VER: 3.0.6
|
|
TESTSSL_URL: https://codeload.github.com/drwetter/testssl.sh/tar.gz/refs/tags/v
|
|
|
|
- name: Setup core dump directory
|
|
run: |
|
|
sudo mkdir /cores/ && sudo chmod 777 /cores/
|
|
echo "/cores/%E.%p" | sudo tee /proc/sys/kernel/core_pattern
|
|
|
|
- name: Test with pytest
|
|
run: |
|
|
ulimit -c unlimited # Enable core dumps to be captured
|
|
python -c 'from deluge._libtorrent import lt; print(lt.__version__)';
|
|
catchsegv python -X dev -m pytest -v -m "not (todo or gtkui)" deluge
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
# capture all crashes as build artifacts
|
|
if: failure()
|
|
with:
|
|
name: crashes
|
|
path: /cores
|
|
|
|
test-windows:
|
|
runs-on: windows-2019
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.7", "3.10"]
|
|
|
|
steps:
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: "pip"
|
|
cache-dependency-path: "requirements*.txt"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install --upgrade pip wheel
|
|
pip install -r requirements.txt -r requirements-tests.txt
|
|
pip install -e .
|
|
|
|
- name: Test with pytest
|
|
run: |
|
|
python -c 'import libtorrent as lt; print(lt.__version__)';
|
|
pytest -v -m "not (todo or gtkui or security)" deluge
|