Skip to content

Commit

Permalink
revert the PKGBUILD temporarily since it's blocking the build
Browse files Browse the repository at this point in the history
and fix the broken tests, will have to redo how the commands are put
togther, however this will work for now.
  • Loading branch information
mcgillij committed Jul 7, 2024
1 parent 55416b2 commit 00cf6ea
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
27 changes: 27 additions & 0 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Maintainer: Jason McGillivray < mcgillivray dot jason at gmail dot com>


pkgname=amdfan
pkgdesc="Python daemon for controlling the fans on amdgpu cards"
pkgver=0.2.0
pkgrel=1
arch=('any')
license=('GPL2')
depends=('python' 'python-yaml' 'python-numpy' 'python-rich' 'python-click')
makedepends=('python-poetry-core' 'python-build' 'python-installer')
url="https://github.com/mcgillij/amdfan"
source=("https://github.com/mcgillij/amdfan/releases/download/$pkgver/amdfan-$pkgver.tar.gz")
#source=("amdfan-$pkgver.tar.gz")
md5sums=('58db7ccf6255d4866efc75cc9c89a66a')

build() {
cd "$srcdir/$pkgname-$pkgver"
python -m build --wheel --no-isolation
}

package() {
cd "$srcdir/$pkgname-$pkgver"
python -m installer --destdir="$pkgdir" dist/*.whl
mkdir -p "$pkgdir/usr/lib/systemd/system"
install -Dm644 src/amdfan/amdfan.service "$pkgdir/usr/lib/systemd/system/"
}
17 changes: 6 additions & 11 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,25 @@

from click.testing import CliRunner

from amdfan.commands import cli
from amdfan.commands import cli, run_daemon, set_fan_speed


class TestCli(unittest.TestCase):
def test_params(self):
daemon_param = ["daemon"]
runner = CliRunner()
result = runner.invoke(cli, daemon_param)
result = runner.invoke(run_daemon)
assert result.exception
assert result.exit_code == 1 # should be permission denied for non-root

help_param = ["--help"]
result = runner.invoke(cli, help_param)
result = runner.invoke(cli, ["--help"])
assert result.exit_code == 0

config_param = ["print-default", "--configuration"]
result = runner.invoke(cli, config_param)
result = runner.invoke(cli, ["--configuration"])
assert result.exit_code == 0

service_param = ["print-default", "--service=systemd"]
result = runner.invoke(cli, service_param)
result = runner.invoke(cli, ["--service=systemd"])
assert result.exit_code == 0

manual_param = "set"
result = runner.invoke(cli, manual_param, input="\n".join(["card0", "25"]))
result = runner.invoke(set_fan_speed, input="\n".join(["card0", "25"]))
assert result.exception
assert result.exit_code == 1 # should be permission denied for non-root

0 comments on commit 00cf6ea

Please sign in to comment.