Skip to content

Commit

Permalink
Update commoncode to v31.1.0
Browse files Browse the repository at this point in the history
    * Use new system markers in tests

Signed-off-by: Jono Yang <jyang@nexb.com>
  • Loading branch information
JonoYang committed May 15, 2024
1 parent 5429e9c commit 50d96df
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 29 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ chardet==5.0.0
charset-normalizer==2.1.0
click==8.1.3
colorama==0.4.5
commoncode==31.0.2
commoncode==31.1.0
construct==2.10.68
container-inspector==31.1.0
cryptography==37.0.4
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ python_requires = >=3.7
install_requires =
attrs >= 18.1,!=20.1.0;python_version<'3.11'
attrs >= 22.1.0;python_version>='3.11'
commoncode >= 31.0.2
commoncode >= 31.1.0
plugincode >= 32.0.0
typecode >= 30.0.1

Expand Down
4 changes: 2 additions & 2 deletions tests/test_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
#

import os
import platform
from pathlib import Path

import pytest
from commoncode import date as commoncode_date
from commoncode import fileutils
from commoncode.system import on_linux
from commoncode.system import on_mac
from commoncode.system import on_macos_arm64
from commoncode.system import on_windows
from commoncode.testcase import is_same
from extractcode_assert_utils import BaseArchiveTestCase
Expand Down Expand Up @@ -1692,7 +1692,7 @@ def test_extract_rar_with_invalid_path(self):
def test_extract_rar_with_trailing_data(self):
test_file = self.get_test_loc('archive/rar/rar_trailing.rar')
test_dir = self.get_temp_dir()
if on_mac and platform.machine() == 'arm64':
if on_macos_arm64:
archive.extract_rar(test_file, test_dir)
else:
expected = Exception('Unknown error')
Expand Down
27 changes: 2 additions & 25 deletions tests/test_vmimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,15 @@
import pytest

from commoncode.system import on_linux
from commoncode.system import on_ubuntu_22

from extractcode_assert_utils import BaseArchiveTestCase
from extractcode_assert_utils import check_files

from extractcode import vmimage


def get_etc_os_release_info(os_release_path='/etc/os-release'):
cfg_kv = {}
with open(os_release_path) as f:
for line in f:
split_line = line.split('=')
if not split_line:
continue
k = split_line[0].strip()
v = split_line[-1].strip()
cfg_kv[k] = v
return cfg_kv


def is_on_ubuntu_22():
if not on_linux:
return False
os_release_info = get_etc_os_release_info()
return os_release_info['ID'] == 'ubuntu' and '22' in os_release_info['VERSION_ID']

on_ubuntu_22 = is_on_ubuntu_22()

del is_on_ubuntu_22


@pytest.mark.skipif(not on_linux or on_ubuntu_22, reason='Only linux supports image extraction, kernel is unreadable on Ubuntu 22.04')
@pytest.mark.skipif((not on_linux) or on_ubuntu_22, reason='Only linux supports image extraction, kernel is unreadable on Ubuntu 22.04')
class TestExtractVmImage(BaseArchiveTestCase):
test_data_dir = os.path.join(os.path.dirname(__file__), 'data')

Expand Down

0 comments on commit 50d96df

Please sign in to comment.