mirror of
https://github.com/Shu-Ying/main_plugin_farm.git
synced 2026-10-27 20:50:06 +08:00
fixed # 修复工作流BUG
This commit is contained in:
@@ -8,8 +8,7 @@ from zipfile import ZipFile
|
|||||||
|
|
||||||
ROOT = Path(__file__).resolve().parents[1]
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
sys.path.insert(0, str(ROOT / 'src'))
|
sys.path.insert(0, str(ROOT / 'src'))
|
||||||
from farm_core.catalogue_release import parse_manifest
|
from farm_core.catalogue_release import ROOTS, parse_manifest
|
||||||
from farm_render.catalogue_bundle import ROOTS
|
|
||||||
|
|
||||||
|
|
||||||
def check(root):
|
def check(root):
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ FILES = {
|
|||||||
MANIFEST_LIMIT = 16 * 1024
|
MANIFEST_LIMIT = 16 * 1024
|
||||||
DIGEST = re.compile(r'[0-9a-f]{64}')
|
DIGEST = re.compile(r'[0-9a-f]{64}')
|
||||||
VERSION = re.compile(r'[A-Za-z0-9._-]{1,64}')
|
VERSION = re.compile(r'[A-Za-z0-9._-]{1,64}')
|
||||||
|
ROOTS = {
|
||||||
|
'Github': 'https://raw.githubusercontent.com/Shu-Ying/'
|
||||||
|
'farm_service/main/catalogue',
|
||||||
|
'Gitea': 'https://gitea.diuse.work/Diuse/farm_service/'
|
||||||
|
'raw/branch/main/catalogue',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def _pairs(items):
|
def _pairs(items):
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import uuid
|
|||||||
from zipfile import BadZipFile
|
from zipfile import BadZipFile
|
||||||
|
|
||||||
from farm_core.catalogue_release import (
|
from farm_core.catalogue_release import (
|
||||||
FILES, MANIFEST_LIMIT, canonical, check_file, decode, load_catalogue,
|
FILES, MANIFEST_LIMIT, ROOTS, canonical, check_file, decode, load_catalogue,
|
||||||
parse_manifest,
|
parse_manifest,
|
||||||
)
|
)
|
||||||
from farm_core.domain import FarmError
|
from farm_core.domain import FarmError
|
||||||
@@ -23,12 +23,6 @@ from .release_validation import validate_archive, validate_metadata
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
_LOCK = threading.RLock()
|
_LOCK = threading.RLock()
|
||||||
_FAILURES = (OSError, ValueError, FarmError, EOFError, BadZipFile)
|
_FAILURES = (OSError, ValueError, FarmError, EOFError, BadZipFile)
|
||||||
ROOTS = {
|
|
||||||
'Github': 'https://raw.githubusercontent.com/Shu-Ying/'
|
|
||||||
'farm_service/main/catalogue',
|
|
||||||
'Gitea': 'https://gitea.diuse.work/Diuse/farm_service/'
|
|
||||||
'raw/branch/main/catalogue',
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
@@ -12,6 +14,15 @@ ZIP = ROOT / 'src/farm_render/data/assets.zip'
|
|||||||
|
|
||||||
|
|
||||||
class BundleTests(unittest.TestCase):
|
class BundleTests(unittest.TestCase):
|
||||||
|
def test_manifest_check_without_third_party_packages(self):
|
||||||
|
result = subprocess.run(
|
||||||
|
[sys.executable, '-S',
|
||||||
|
str(ROOT / 'scripts/check_asset_manifest.py')],
|
||||||
|
cwd=ROOT, capture_output=True, text=True, timeout=30,
|
||||||
|
)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||||
|
self.assertIn('Verified external asset manifest', result.stdout)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.temp = tempfile.TemporaryDirectory()
|
self.temp = tempfile.TemporaryDirectory()
|
||||||
self.addCleanup(self.temp.cleanup)
|
self.addCleanup(self.temp.cleanup)
|
||||||
|
|||||||
Reference in New Issue
Block a user