testing/py3-snapshottest: rebuild against python 3.12

This commit is contained in:
ptrcnull 2024-04-19 16:05:14 +02:00
parent fb7dabe819
commit e44f223f7f
2 changed files with 29 additions and 2 deletions

View File

@ -2,7 +2,7 @@
# Maintainer: Bart Ribbers <bribbers@disroot.org> # Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-snapshottest pkgname=py3-snapshottest
pkgver=0.6.0 pkgver=0.6.0
pkgrel=3 pkgrel=4
pkgdesc="Snapshot testing for pytest, unittest, Django, and Nose" pkgdesc="Snapshot testing for pytest, unittest, Django, and Nose"
url="https://github.com/syrusakbary/snapshottest" url="https://github.com/syrusakbary/snapshottest"
arch="noarch" arch="noarch"
@ -21,7 +21,9 @@ checkdepends="
py3-six py3-six
" "
subpackages="$pkgname-pyc" subpackages="$pkgname-pyc"
source="https://pypi.python.org/packages/source/s/snapshottest/snapshottest-$pkgver.tar.gz" source="https://pypi.python.org/packages/source/s/snapshottest/snapshottest-$pkgver.tar.gz
importlib.patch
"
builddir="$srcdir/snapshottest-$pkgver" builddir="$srcdir/snapshottest-$pkgver"
build() { build() {
@ -38,4 +40,5 @@ package() {
sha512sums=" sha512sums="
0f39ec0b2255291d35bcc873b73b3802b427efd53b8d12ab373a76193dfe9d108534980f8081be38fadbf2392915e8e0d63547e5bf0479ea06d8d79cde4016ce snapshottest-0.6.0.tar.gz 0f39ec0b2255291d35bcc873b73b3802b427efd53b8d12ab373a76193dfe9d108534980f8081be38fadbf2392915e8e0d63547e5bf0479ea06d8d79cde4016ce snapshottest-0.6.0.tar.gz
2ee20d34f7db1a736401d0b217576dad1b308bb69b578a17123cfeab3e363c0cfc0348e321c2f299f01324997034230c61ed3eba6145da1f726f64474d5aa39a importlib.patch
" "

View File

@ -0,0 +1,24 @@
replace deprecated imp module
diff --git a/snapshottest/module.py b/snapshottest/module.py
index 2f02c83..b0959ed 100644
--- a/snapshottest/module.py
+++ b/snapshottest/module.py
@@ -1,7 +1,7 @@
import codecs
import errno
import os
-import imp
+from importlib.machinery import SourceFileLoader
from collections import defaultdict
import logging
@@ -29,7 +29,7 @@ class SnapshotModule(object):
def load_snapshots(self):
try:
- source = imp.load_source(self.module, self.filepath)
+ source = SourceFileLoader(self.module, self.filepath).load_module()
# except FileNotFoundError: # Python 3
except (IOError, OSError) as err:
if err.errno == errno.ENOENT: