Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package obs-service-tar_scm for
openSUSE:Factory checked in at 2022-01-14 23:12:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-service-tar_scm (Old)
and /work/SRC/openSUSE:Factory/.obs-service-tar_scm.new.1892 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "obs-service-tar_scm"
Fri Jan 14 23:12:46 2022 rev:71 rq:945843 version:0.10.30.1641990734.bdad8f9
Changes:
--------
--- /work/SRC/openSUSE:Factory/obs-service-tar_scm/obs-service-tar_scm.changes
2021-12-31 13:44:29.537267832 +0100
+++
/work/SRC/openSUSE:Factory/.obs-service-tar_scm.new.1892/obs-service-tar_scm.changes
2022-01-14 23:13:23.302637505 +0100
@@ -1,0 +2,15 @@
+Wed Jan 12 12:45:18 UTC 2022 - [email protected]
+
+- Update to version 0.10.30.1641990734.bdad8f9:
+ * fixes for python2.7 compatibility
+ * fix test cases
+ * fix various linter problems with pylint 2.11.1
+ * disable consider-using-f-string in pylint
+ * added TC for _stash_pop_required
+ * assertTarIsDeeply now more verbose in case of failure
+ * remove tearDown/Trace from testenv.py
+ * fix regression to keep local changes when running in osc
+ * various fixes to make linter happy
+ * fix tests for python 2.7
+
+-------------------------------------------------------------------
Old:
----
obs-service-tar_scm-0.10.29.1634038025.85bfc3f.tar.gz
New:
----
obs-service-tar_scm-0.10.30.1641990734.bdad8f9.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ obs-service-tar_scm.spec ++++++
--- /var/tmp/diff_new_pack.DsKg7K/_old 2022-01-14 23:13:24.826638487 +0100
+++ /var/tmp/diff_new_pack.DsKg7K/_new 2022-01-14 23:13:24.830638490 +0100
@@ -1,7 +1,7 @@
#
# spec file
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -119,8 +119,8 @@
%define pkg_name obs-service-tar_scm
Name: %{pkg_name}%{nsuffix}
-%define version_unconverted 0.10.29.1634038025.85bfc3f
-Version: 0.10.29.1634038025.85bfc3f
+%define version_unconverted 0.10.30.1641990734.bdad8f9
+Version: 0.10.30.1641990734.bdad8f9
Release: 0
Summary: An OBS source service: create tar ball from svn/git/hg
License: GPL-2.0-or-later
++++++ PKGBUILD ++++++
--- /var/tmp/diff_new_pack.DsKg7K/_old 2022-01-14 23:13:24.858638508 +0100
+++ /var/tmp/diff_new_pack.DsKg7K/_new 2022-01-14 23:13:24.862638510 +0100
@@ -1,5 +1,5 @@
pkgname=obs-service-tar_scm
-pkgver=0.10.29.1634038025.85bfc3f
+pkgver=0.10.30.1641990734.bdad8f9
pkgrel=0
pkgdesc="Source Service for the OpenSUSE Build Service (OBS)"
arch=('any')
++++++ _service ++++++
--- /var/tmp/diff_new_pack.DsKg7K/_old 2022-01-14 23:13:24.890638528 +0100
+++ /var/tmp/diff_new_pack.DsKg7K/_new 2022-01-14 23:13:24.890638528 +0100
@@ -1,6 +1,6 @@
<services>
<service name="tar_scm" mode="disabled">
- <param name="url">git://github.com/openSUSE/obs-service-tar_scm.git</param>
+ <param
name="url">https://github.com/openSUSE/obs-service-tar_scm.git</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="version">git-master</param>
++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.DsKg7K/_old 2022-01-14 23:13:24.910638541 +0100
+++ /var/tmp/diff_new_pack.DsKg7K/_new 2022-01-14 23:13:24.914638544 +0100
@@ -7,6 +7,8 @@
<param
name="changesrevision">9e8b88b088778c44db56781e6a908a0e82e27cf2</param></service>
<service name="tar_scm">
<param
name="url">git://github.com/openSUSE/obs-service-tar_scm.git</param>
- <param
name="changesrevision">85bfc3fabb06212b49a389afb3310bfbf2996913</param></service></servicedata>
+ <param
name="changesrevision">85bfc3fabb06212b49a389afb3310bfbf2996913</param></service><service
name="tar_scm">
+ <param
name="url">https://github.com/openSUSE/obs-service-tar_scm.git</param>
+ <param
name="changesrevision">bdad8f941c0455ea30970aaee53b9e47ba26c93c</param></service></servicedata>
(No newline at EOF)
++++++ debian.dsc ++++++
--- /var/tmp/diff_new_pack.DsKg7K/_old 2022-01-14 23:13:24.930638554 +0100
+++ /var/tmp/diff_new_pack.DsKg7K/_new 2022-01-14 23:13:24.934638557 +0100
@@ -1,6 +1,6 @@
Format: 1.0
Source: obs-service-tar-scm
-Version: 0.10.29.1634038025.85bfc3f
+Version: 0.10.30.1641990734.bdad8f9
Provides: obs-service-obs_scm, obs-service-tar
Binary: obs-service-tar_scm
Maintainer: Adrian Schroeter <[email protected]>
++++++ obs-service-tar_scm-0.10.29.1634038025.85bfc3f.tar.gz ->
obs-service-tar_scm-0.10.30.1641990734.bdad8f9.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/.pylinttestsrc
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/.pylinttestsrc
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/.pylinttestsrc
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/.pylinttestsrc
2022-01-12 13:32:14.000000000 +0100
@@ -84,7 +84,7 @@
# a feature request to improve pylint in this respect:
# https://github.com/PyCQA/pylint/issues/246
-disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating,missing-docstring,old-style-class,bad-whitespace,duplicate-code,too-many-public-methods,protected-access,too-many-locals,consider-using-with,c
onsider-using-f-string
+disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating,missing-docstring,old-style-class,bad-whitespace,duplicate-code,too-many-public-methods,protected-access,too-many-locals,consider-using-with,c
onsider-using-f-string,super-with-arguments
[REPORTS]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/KankuFile
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/KankuFile
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/KankuFile
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/KankuFile
2022-01-12 13:32:14.000000000 +0100
@@ -57,4 +57,4 @@
# test python3
- make -C /tmp/kanku clean check3
# test python2
- - make -C /tmp/kanku clean check2
+ - make -C /tmp/kanku clean test2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/TarSCM/helpers.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/helpers.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/TarSCM/helpers.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/helpers.py
2022-01-12 13:32:14.000000000 +0100
@@ -4,6 +4,7 @@
import os
import logging
import subprocess
+import io
# python3 renaming of StringIO
try:
@@ -12,6 +13,17 @@
from io import StringIO
+def file_write_legacy(fname, string, *args):
+ '''function to write string to file python 2/3 compatible'''
+ mode = 'w'
+ if args:
+ mode = args[0]
+
+ with io.open(fname, mode, encoding='utf-8') as outfile:
+ # 'str().encode().decode()' is required for pyhton 2/3 compatibility
+ outfile.write(str(string).encode('UTF-8').decode('UTF-8'))
+
+
class Helpers():
def run_cmd(self, cmd, cwd, interactive=False, raisesysexit=False):
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/TarSCM/tasks.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/tasks.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/TarSCM/tasks.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/tasks.py
2022-01-12 13:32:14.000000000 +0100
@@ -13,11 +13,12 @@
import re
import locale
import json
+import io
import yaml
import TarSCM.scm
import TarSCM.archive
-from TarSCM.helpers import Helpers
+from TarSCM.helpers import Helpers, file_write_legacy
from TarSCM.changes import Changes
from TarSCM.exceptions import OptionsError
@@ -67,7 +68,7 @@
if args.appimage:
# we read the SCM config from appimage.yml
- with open('appimage.yml', encoding='utf-8') as filehandle:
+ with io.open('appimage.yml', encoding='utf-8') as filehandle:
self.data_map = yaml.safe_load(filehandle)
args.use_obs_scm = True
build_scms = ()
@@ -87,7 +88,7 @@
elif args.snapcraft:
# we read the SCM config from snapcraft.yaml instead
# getting it via parameters
- with open('snapcraft.yaml', encoding='utf-8') as filehandle:
+ with io.open('snapcraft.yaml', encoding='utf-8') as filehandle:
self.data_map = yaml.safe_load(filehandle)
args.use_obs_scm = True
# run for each part an own task
@@ -126,9 +127,8 @@
# we prefix our own here to be sure to not overwrite user files,
# if he is using us in "disabled" mode
new_file = args.outdir + '/_service:snapcraft:snapcraft.yaml'
- with open(new_file, 'w', encoding='utf-8') as outfile:
- outfile.write(yaml.dump(self.data_map,
- default_flow_style=False))
+ yml_str = yaml.dump(self.data_map, default_flow_style=False)
+ file_write_legacy(new_file, yml_str)
# execute also download_files for downloading single sources
if args.snapcraft or args.appimage:
@@ -150,7 +150,7 @@
return args
# is it a branch request?
- with open("_branch_request", "r", encoding='utf-8') as ofh:
+ with io.open("_branch_request", "r", encoding='utf-8') as ofh:
dat = json.load(ofh)
if dat.get('object_kind') == 'merge_request':
# gitlab merge request
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/archiveobscpiotestcases.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/archiveobscpiotestcases.py
---
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/archiveobscpiotestcases.py
2021-10-12 13:27:05.000000000 +0200
+++
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/archiveobscpiotestcases.py
2022-01-12 13:32:14.000000000 +0100
@@ -6,6 +6,7 @@
import inspect
import shutil
import unittest
+import io
import six
import yaml
@@ -62,7 +63,7 @@
infofile = os.path.join(outdir, bname + ".obsinfo")
self.assertTrue(os.path.isfile(cpiofile))
self.assertTrue(os.path.isfile(infofile))
- with open(infofile, 'r', encoding='UTF-8') as fhl:
+ with io.open(infofile, 'r', encoding='UTF-8') as fhl:
data = yaml.safe_load(fhl)
self.assertDictEqual(
data, {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/fake_classes.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/fake_classes.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/fake_classes.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/fake_classes.py
2022-01-12 13:32:14.000000000 +0100
@@ -8,7 +8,7 @@
keyring_passphrase = ''
maintainers_asc = None
def __init__(self, match_tag=False):
- super(FakeCli, self).__init__() # pylint: disable=R1725
+ super(FakeCli, self).__init__()
self.match_tag = match_tag
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/fixtures.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/fixtures.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/fixtures.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/fixtures.py
2022-01-12 13:32:14.000000000 +0100
@@ -3,7 +3,9 @@
import os
import shutil
+import io
+from utils import file_write_legacy
class Fixtures:
@@ -118,8 +120,7 @@
newly_created.append(subdir)
for fname in ('a', subdir + '/b'):
- with open(fname, 'w', encoding="UTF-8") as fhn:
- fhn.write(str(new_rev))
+ file_write_legacy(fname, new_rev)
self.scmlogs.annotate("Wrote %s to %s" % (new_rev, fname))
# we never commit through symlink 'c' but instead see the updated
@@ -155,8 +156,7 @@
new_rev = self.next_commit_rev(wdir)
fname = 'd'
- with open(fname, 'w', encoding='UTF-8') as cfh:
- cfh.write(str(new_rev))
+ file_write_legacy(fname, new_rev)
self.scmlogs.annotate("Wrote %s to %s" % (new_rev, fname))
self.safe_run('add .')
date = self.get_committer_date()
@@ -166,7 +166,7 @@
def touch(self, fname, times=None):
fpath = os.path.join(self.wdir, fname)
- with open(fpath, 'a', encoding='UTF-8'):
+ with io.open(fpath, 'a', encoding='UTF-8'):
os.utime(fname, times)
def remove(self, fname):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/gittests.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/gittests.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/gittests.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/gittests.py
2022-01-12 13:32:14.000000000 +0100
@@ -6,8 +6,11 @@
import re
import tarfile
import shutil
+import io
import mock
+from utils import file_write_legacy
+
from tests.githgtests import GitHgTests
from tests.gitsvntests import GitSvnTests
from tests.gitfixtures import GitFixtures
@@ -205,7 +208,7 @@
self.assertTrue('_servicedata' in dirents,
'_servicedata in %s' % repr(dirents))
sdf = os.path.join(self.outdir, '_servicedata')
- with open(sdf, 'r', encoding='UTF-8') as sdatf:
+ with io.open(sdf, 'r', encoding='UTF-8') as sdatf:
sdat = sdatf.read()
expected = (
r"\s*<servicedata>"
@@ -369,8 +372,7 @@
repo_path = fix.repo_path
os.chdir(repo_path)
os.mkdir("test")
- with open("test/myfile.txt", 'w', encoding="UTF-8") as file:
- file.write("just for testing")
+ file_write_legacy("test/myfile.txt", "just for testing")
fix.safe_run('add test')
fix.safe_run('commit -m "added tests"')
fix.safe_run('tag test')
@@ -395,8 +397,7 @@
test_txt = os.path.join(repo_dir, 'test.txt')
fix.touch(test_txt)
file4 = os.path.join(repo_dir, 'file.4')
- with open(file4, 'a', encoding='UTF-8') as fh4:
- fh4.write("just for testing")
+ file_write_legacy(file4, "just for testing")
# disable cachedirectory (would not be used with osc by default)
os.environ['CACHEDIRECTORY'] = ""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/hgfixtures.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/hgfixtures.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/hgfixtures.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/hgfixtures.py
2022-01-12 13:32:14.000000000 +0100
@@ -3,7 +3,7 @@
import os
from fixtures import Fixtures
-from utils import run_hg
+from utils import run_hg, file_write_legacy
class HgFixtures(Fixtures):
@@ -29,8 +29,8 @@
os.makedirs(self.repo_path)
os.chdir(self.repo_path)
self.safe_run('init')
- with open('.hg/hgrc', 'w', encoding='UTF-8') as rcf:
- rcf.write("[ui]\nusername = %s\n" % self.name_and_email)
+ out = "[ui]\nusername = %s\n" % self.name_and_email
+ file_write_legacy('.hg/hgrc', out)
self.wdir = self.repo_path
print("created repo %s" % self.repo_path)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/scmlogs.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/scmlogs.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/scmlogs.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/scmlogs.py
2022-01-12 13:32:14.000000000 +0100
@@ -3,6 +3,9 @@
import glob
import os
import tempfile
+import io
+
+from utils import file_write_legacy
class ScmInvocationLogs:
@@ -76,12 +79,11 @@
def annotate(self, msg):
print(msg)
- with open(self.current_log_path, 'a', encoding="UTF-8") as log:
- log.write('# ' + msg + "\n")
+ file_write_legacy(self.current_log_path, '# ' + msg + "\n", 'a')
def read(self):
if not os.path.exists(self.current_log_path):
return '<no %s log>' % self.scm
- with open(self.current_log_path, 'r', encoding="UTF-8") as log:
+ with io.open(self.current_log_path, 'r', encoding="UTF-8") as log:
loglines = log.readlines()
return loglines
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/svnfixtures.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/svnfixtures.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/svnfixtures.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/svnfixtures.py
2022-01-12 13:32:14.000000000 +0100
@@ -4,7 +4,7 @@
import stat
from datetime import datetime
-from utils import mkfreshdir, quietrun, run_svn
+from utils import mkfreshdir, quietrun, run_svn, file_write_legacy
from fixtures import Fixtures
@@ -37,8 +37,7 @@
quietrun('svnadmin create ' + self.repo_path)
# allow revprop changes to explicitly set svn:date
hook = self.repo_path + '/hooks/pre-revprop-change'
- with open(hook, 'w', encoding='UTF-8') as cfh:
- cfh.write("#!/bin/sh\nexit 0;\n")
+ file_write_legacy(hook, "#!/bin/sh\nexit 0;\n")
sta = os.stat(hook)
os.chmod(hook, sta.st_mode | stat.S_IEXEC)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/svntests.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/svntests.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/svntests.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/svntests.py
2022-01-12 13:32:14.000000000 +0100
@@ -2,6 +2,7 @@
import os
import re
+import io
from gitsvntests import GitSvnTests
from svnfixtures import SvnFixtures
@@ -56,7 +57,8 @@
dirents = self.assertNumDirents(self.outdir, expected_dirents)
self.assertTrue('_servicedata' in dirents,
'_servicedata in %s' % repr(dirents))
- with open(os.path.join(self.outdir, '_servicedata')) as sdata:
+ infile = os.path.join(self.outdir, '_servicedata')
+ with io.open(infile, 'r', encoding='UTF-8') as sdata:
sdat = sdata.read()
expected = (
r"<servicedata>"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/tartests.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/tartests.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/tartests.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/tartests.py
2022-01-12 13:32:14.000000000 +0100
@@ -3,6 +3,8 @@
import os
+from utils import file_write_legacy
+
from tests.tarfixtures import TarFixtures
from tests.testenv import TestEnvironment
from tests.testassertions import TestAssertions
@@ -26,13 +28,12 @@
info = os.path.join(wdir, "test.obsinfo")
print("INFOFILE: '%s'" % info)
os.chdir(self.pkgdir)
- with open(info, 'w', encoding='UTF-8') as obsinfo:
- obsinfo.write(
- "name: pkgname\n" +
- "version: 0.1.1\n" +
- "mtime: 1476683264\n" +
- "commit: fea6eb5f43841d57424843c591b6c8791367a9e5\n"
- )
+ out_str = "name: pkgname\n" \
+ "version: 0.1.1\n" \
+ "mtime: 1476683264\n" \
+ "commit: fea6eb5f43841d57424843c591b6c8791367a9e5\n"
+ file_write_legacy(info, out_str)
+
src_dir = os.path.join(wdir, "pkgname")
os.mkdir(src_dir)
self.tar_scm_std()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/tasks.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/tasks.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/tasks.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/tasks.py
2022-01-12 13:32:14.000000000 +0100
@@ -4,6 +4,8 @@
import inspect
import shutil
import unittest
+import io
+
from mock import MagicMock
from tar_scm import TarSCM
@@ -32,10 +34,13 @@
self.cli.parse_args(['--outdir', self.outdir, '--scm', 'git'])
self.cli.snapcraft = True
- def _cd_fixtures_dir(self):
+ def _cd_fixtures_dir(self, *args):
self.cur_dir = os.getcwd()
cl_name = self.__class__.__name__
fn_name = inspect.stack()[1][3]
+ if args:
+ fn_name = args[0]
+
try:
os.chdir(os.path.join(self.basedir, 'fixtures', cl_name, fn_name))
except OSError:
@@ -50,19 +55,22 @@
os.getcwd())
raise
+ def _generate_tl_common(self, expected, func):
+ self._cd_fixtures_dir(func)
+ tasks = TarSCM.Tasks(self.cli)
+ tasks.generate_list()
+ self._restore_cwd()
+ for key, val in expected.items():
+ self.assertEqual(tasks.task_list[0].__dict__[key], val)
+ self.assertEqual(len(tasks.task_list), 1)
+
def test_generate_tl_single_task(self):
expected = {
'scm': 'bzr', 'clone_prefix': '_obs_', 'snapcraft': True,
'revision': None, 'url': 'lp:~mterry/libpipeline/printf',
'filename': 'libpipeline', 'use_obs_scm': True,
'outdir': self.cli.outdir, 'changesgenerate': False}
- self._cd_fixtures_dir()
- tasks = TarSCM.Tasks(self.cli)
- tasks.generate_list()
- self._restore_cwd()
- for k in expected: # pylint: disable=C0206
- self.assertEqual(tasks.task_list[0].__dict__[k], expected[k])
- self.assertEqual(len(tasks.task_list), 1)
+ self._generate_tl_common(expected, 'test_generate_tl_single_task')
def test_generate_tl_st_appimage(self):
'''Test generates task list with single task from appimage.yml'''
@@ -76,13 +84,7 @@
'outdir': self.cli.outdir,
'changesgenerate': False
}
- self._cd_fixtures_dir()
- tasks = TarSCM.Tasks(self.cli)
- tasks.generate_list()
- self._restore_cwd()
- for k in expected: # pylint: disable=C0206
- self.assertEqual(tasks.task_list[0].__dict__[k], expected[k])
- self.assertEqual(len(tasks.task_list), 1)
+ self._generate_tl_common(expected, 'test_generate_tl_st_appimage')
def test_appimage_empty_build(self):
self.cli.snapcraft = False
@@ -164,7 +166,7 @@
tasks.finalize()
self._restore_cwd()
snf = os.path.join(self.cli.outdir,'_service:snapcraft:snapcraft.yaml')
- with open(snf, 'r', encoding='utf-8') as scf:
+ with io.open(snf, 'r', encoding='utf-8') as scf:
got = scf.read()
self.assertEqual(got, expected)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/unittestcases.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/unittestcases.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/unittestcases.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/unittestcases.py
2022-01-12 13:32:14.000000000 +0100
@@ -7,8 +7,11 @@
import copy
import unittest
import six
+
from mock import patch
+from utils import file_write_legacy
+
import TarSCM
from TarSCM.helpers import Helpers
@@ -287,13 +290,11 @@
print("INFOFILE: '%s'" % info)
# check for slash in name
- with open(info, 'w', encoding='UTF-8') as f_h:
- f_h.write(
- "name: test/test\n" +
- "version: 0.1.1\n" +
- "mtime: 1476683264\n" +
- "commit: fea6eb5f43841d57424843c591b6c8791367a9e5\n"
- )
+ string = "name: test/test\n" \
+ "version: 0.1.1\n" \
+ "mtime: 1476683264\n" \
+ "commit: fea6eb5f43841d57424843c591b6c8791367a9e5\n"
+ file_write_legacy(info, string)
os.chdir(wdir)
six.assertRaisesRegex(
self,
@@ -303,13 +304,11 @@
)
# check for slash in version
- with open(info, 'w', encoding='UTF-8') as f_h:
- f_h.write(
- "name: test\n" +
- "version: a/0.1.1\n" +
- "mtime: 1476683264\n" +
- "commit: fea6eb5f43841d57424843c591b6c8791367a9e5\n"
- )
+ string = "name: test\n" \
+ "version: a/0.1.1\n" \
+ "mtime: 1476683264\n" \
+ "commit: fea6eb5f43841d57424843c591b6c8791367a9e5\n"
+ file_write_legacy(info, string)
os.chdir(wdir)
six.assertRaisesRegex(
self,
@@ -319,13 +318,11 @@
)
# check for .. in version
- with open(info, 'w', encoding='UTF-8') as f_h:
- f_h.write(
- "name: test\n" +
- "version: ..0.1.1\n" +
- "mtime: 1476683264\n" +
- "commit: fea6eb5f43841d57424843c591b6c8791367a9e5\n"
- )
+ string = "name: test\n" \
+ "version: ..0.1.1\n" \
+ "mtime: 1476683264\n" \
+ "commit: fea6eb5f43841d57424843c591b6c8791367a9e5\n"
+ file_write_legacy(info, string)
os.chdir(wdir)
six.assertRaisesRegex(
self,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/utils.py
new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/utils.py
--- old/obs-service-tar_scm-0.10.29.1634038025.85bfc3f/tests/utils.py
2021-10-12 13:27:05.000000000 +0200
+++ new/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/utils.py
2022-01-12 13:32:14.000000000 +0100
@@ -5,6 +5,7 @@
import os
import re
+import io
import shutil
import subprocess
import six
@@ -70,3 +71,13 @@
def run_bzr(repo, args):
return run_scm('bzr', repo, args)
+
+def file_write_legacy(fname, string, *args):
+ '''function to write string to file python 2/3 compatible'''
+ mode = 'w'
+ if args:
+ mode = args[0]
+
+ with io.open(fname, mode, encoding='utf-8') as outfile:
+ # 'str().encode().decode()' is required for pyhton 2/3 compatibility
+ outfile.write(str(string).encode('UTF-8').decode('UTF-8'))