-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add not worth mentioning initial skeleton for testing using pytest #37
base: master
Are you sure you want to change the base?
Changes from all commits
8bf2211
bfa297a
74a318c
9acf27e
3c75bd0
bd52f0c
a0cc89d
f1c2b79
0fad6c0
778a361
877c98b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
# re-enable whenever it works! | ||
# schedule: | ||
# - cron: '0 6 * * *' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
# got "ERROR tests/test_low.py - OSError: Unable to find libfuse" | ||
# - windows-2019 | ||
- ubuntu-latest | ||
# got "installer: Error - The FUSE for macOS installation package is not compatible with this version of macOS." | ||
# from osxfuse | ||
# - macos-latest | ||
# get "Error: The operation was canceled." after PASSED test, odd | ||
# - macos-11 | ||
|
||
python: | ||
- 3.7 | ||
- 3.8 | ||
- 3.9 | ||
- '3.10' # Needs quotes so YAML doesn't think it's 3.1 | ||
- '3.11' | ||
|
||
steps: | ||
- name: Set up environment | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Install Python dependencies and refuse itself | ||
run: | | ||
python -m pip install --upgrade pip wheel | ||
pip install ".[dev]" | ||
|
||
- name: Install FUSE (Linux) | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: | | ||
sudo apt-get update -qq | ||
sudo eatmydata apt-get install -y fuse | ||
|
||
- name: Install OSXFUSE (MacOS) | ||
if: startsWith(matrix.os, 'macos') | ||
run: | | ||
brew update | ||
brew install osxfuse | ||
|
||
- name: Install WinFsp (Windows) | ||
if: startsWith(matrix.os, 'windows') | ||
shell: pwsh | ||
run: | | ||
$url = 'https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-2.0.23075.msi' | ||
Invoke-WebRequest -Uri $url -OutFile 'winfsp.msi' | ||
Start-Process msiexec.exe -ArgumentList '/i', 'winfsp.msi', '/quiet', '/norestart' -Wait | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well -- either |
||
|
||
- name: Run all tests | ||
run: | | ||
python -m pytest -s -v --cov=refuse --cov-report=xml --pyargs refuse | ||
|
||
# enable later | ||
#- name: Upload coverage to Codecov | ||
# uses: codecov/codecov-action@v3 | ||
# with: | ||
# token: ${{ secrets.CODECOV_TOKEN }} | ||
# file: ./coverage.xml | ||
# flags: unittests | ||
# # name: codecov-umbrella | ||
# # yml: ./codecov.yml | ||
# fail_ci_if_error: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
|
||
THIS FILE IS TEMPORARY AND WILL BE REMOVED! | ||
|
||
Copyright (C) 2008-2020 refuse contributors | ||
Copyright (C) 2008-2023 refuse contributors | ||
|
||
<LICENSE_BLOCK> | ||
The contents of this file are subject to the Internet Systems Consortium (ISC) | ||
|
@@ -32,6 +32,7 @@ | |
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
import os | ||
import sys | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. congratulate on the first bug fix contributed due to initiating the testing ;) |
||
import ctypes | ||
from ctypes.util import find_library | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from ..high import FUSE, Operations | ||
|
||
|
||
def test_FUSE(): | ||
pass # for now just that we manage to import it ;) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import ctypes | ||
from ..low import FUSELL, LibFUSE, fuse_args | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def fusell(tmp_path): | ||
yield FUSELL(str(tmp_path)) | ||
|
||
|
||
def test_LibFUSE_mount_unmount(tmp_path): | ||
lib = LibFUSE() | ||
args = ['fuse'] | ||
# worth moving into helper to be reused here | ||
argv = fuse_args(len(args), (ctypes.c_char_p * len(args))(*[arg.encode() for arg in args]), 0) | ||
chan = lib.fuse_mount(str(tmp_path).encode(), argv) | ||
lib.fuse_unmount(str(tmp_path).encode(), chan) | ||
|
||
|
||
# | ||
# likely fusell needs its own thread | ||
# | ||
#def test_nothing_much(fusell): | ||
# assert str(fusell) | ||
# assert repr(fusell) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attempt to run tests with this seems to just stall on macos-11 without any feedback: see https://github.com/yarikoptic/refuse/actions/runs/4559603821/jobs/8043727829 (still running ,will check if outputs anything tomorrow)