--- Begin Message ---
Source: yarsync
Version: 0.2.1-3
Severity: normal
User: debian-pyt...@lists.debian.org
Usertags: python3.13
This package failed build from source when test-built against a version of
python3-defaults that includes 3.13 as a supported version.
To reproduce this issue, build against python3-defaults (python3-all-dev etc.)
from Debian experimental.
What's new in Python 3.13:
https://docs.python.org/3.13/whatsnew/3.13.html
Log snippet:
I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build;
python3.13 -m pytest --ignore=tests/test_clone.py --ignore=tests/test_status.py
============================= test session starts ==============================
platform linux -- Python 3.13.0rc2, pytest-8.3.3, pluggy-1.5.0
rootdir: /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build
configfile: pytest.ini
plugins: typeguard-4.3.0, cov-5.0.0, mock-3.14.0
collected 31 items
tests/test_commit.py F..... [ 19%]
tests/test_env_vars.py . [ 22%]
tests/test_init.py FF. [ 32%]
tests/test_log.py .... [ 45%]
tests/test_pull_push.py ...... [ 64%]
tests/test_remote.py . [ 67%]
tests/test_sync.py .. [ 74%]
tests/test_ys_helpers.py ........ [100%]
=================================== FAILURES ===================================
_________________________________ test_commit __________________________________
mocker = <pytest_mock.plugin.MockerFixture object at 0xffffaccd63c0>
def test_commit(mocker):
"""Test commit creation and logging."""
os.chdir(TEST_DIR_EMPTY)
# important that it goes before patches, need normal initialization
commit_msg = "initial commit"
args = ["yarsync", "commit", "-m", commit_msg]
# we initialize ys here, but don't create a commit.
ys = YARsync(args)
# time.localtime uses time.time
time_3 = time.localtime(3)
def loctime(sec=None):
return time_3
mocker.patch("time.localtime", loctime)
# hope this will work in another time zone.
mocker.patch("time.tzname", "MSK")
# time.time is called a slight instant after time.localtime
# their order is not important though.
commit_time = 2
mocker.patch("time.time", lambda: commit_time)
rename = mocker.patch("os.rename")
mkdir = mocker.patch("os.mkdir")
mocker.patch("socket.gethostname", lambda: "host")
mocker.patch("getpass.getuser", lambda: "user")
m = mocker.mock_open()
# adapted from https://stackoverflow.com/a/38618056/952234
def my_open(filename, mode="r"):
if mode != "r":
return m.return_value
if filename == ys.REPOFILE:
content = "myhost"
else:
raise FileNotFoundError(filename)
file_object = mocker.mock_open(read_data=content).return_value
file_object.__iter__.return_value = content.splitlines(True)
return file_object
mocker.patch("builtins.open", new=my_open)
popen = mocker.patch("subprocess.Popen")
subprocess_mock = mocker.Mock()
attrs = {'communicate.return_value': ('output', 'error')}
subprocess_mock.configure_mock(**attrs)
subprocess_mock.configure_mock(**{"returncode": 0})
popen.return_value = subprocess_mock
commit_name = str(int(commit_time))
commit_dir = os.path.join(ys.COMMITDIR, commit_name)
commit_dir_tmp = commit_dir + "_tmp"
commit_log_path = os.path.join(ys.LOGDIR, commit_name + ".txt")
commit_time_str = time.strftime(ys.DATEFMT, time.localtime())
# call _commit
res = ys()
filter_ = ys._get_filter(include_commits=False)
call = mocker.call
assert res == 0
assert mkdir.mock_calls == [
call(ys.COMMITDIR),
call(ys.LOGDIR),
]
assert rename.mock_calls == [
call(commit_dir_tmp, commit_dir),
]
assert popen.mock_calls == [
call(["rsync", "-a", "--link-dest=../../..", "--exclude=/.ys"]
+ filter_ +
[ys.root_dir + '/', os.path.join(ys.COMMITDIR, "2_tmp")],
stdout=-3),
call().communicate(),
]
# this seems patched, but the date on Python 3.6 is still different
assert time.tzname == "MSK"
# if sys.version_info.minor <= 6:
# # will be UTC
# time_str = time.strftime(ys.DATEFMT, time_3)
# else:
# time_str = "Thu, 01 Jan 1970 03:00:03 MSK"
time_str = time.strftime(ys.DATEFMT, time.localtime(3))
> assert m.mock_calls == [
# call(ys.REPOFILE),
# call().__enter__(),
# call().read(),
# call().__exit__(None, None, None),
# call(commit_log_path, "w"),
call().__enter__(),
call().write(commit_msg + "\n\n"
"When: {}\n".format(time_str) +
"Where: user@myhost"),
call().write('\n'),
call().__exit__(None, None, None),
]
E assert [call().__ent...all().close()] == [call().__ent..., None, None)]
E
E Left contains one more item: call().close()
E Use -v to get more diff
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build/tests/test_commit.py:97:
AssertionError
----------------------------- Captured stdout call -----------------------------
mkdir
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build/tests/test_dir_empty/.ys/commits
rsync -a --link-dest=../../.. --exclude=/.ys '--filter=merge
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build/tests/test_dir_empty/.ys/rsync-filter'
--exclude=/.ys/*
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build/tests/test_dir_empty/
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build/tests/test_dir_empty/.ys/commits/2_tmp
mkdir
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build/tests/test_dir_empty/.ys/logs
commit 2 created
initial commit
When: Thu, 01 Jan 1970 00:00:03 UTC
Where: user@myhost
_______________________________ test_init_mixed ________________________________
mocker = <pytest_mock.plugin.MockerFixture object at 0xffffac911ae0>
def test_init_mixed(mocker):
## Mock existing directory and non-existent files ##
args = "yarsync init".split()
ys0 = YARsync(args)
conffile = ys0.CONFIGFILE
repofile = ys0.REPOFILE.format("my_repo")
def _os_path_exists(filepath):
if filepath == YSDIR:
return True
elif filepath == conffile:
return True
elif filepath.startswith(YSDIR):
print(filepath)
return False
else:
return False # won't get access to real
os.path.exists(filepath)
m = mocker.mock_open()
mocker.patch("builtins.open", m)
# the user inputs "my_host"
mocker.patch("builtins.input", lambda _: "my_repo")
mocker.patch("os.path.exists", _os_path_exists)
# otherwise listdir will complain that .ys doesn't exist
mocker.patch("os.listdir", lambda _: [])
# call _init
res = ys0()
assert res == 0
call = mocker.call
> assert m.mock_calls == [
# call(conffile, "w"), call().__enter__(),
# call().write(CONFIG_EXAMPLE), call().write(''),
# call().__exit__(None, None, None),
call(repofile, "x"), call().__enter__(),
call().__exit__(None, None, None)
]
E AssertionError: assert [call('.ys/re...all().close()] ==
[call('.ys/re..., None, None)]
E
E Left contains one more item: call().close()
E Use -v to get more diff
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build/tests/test_init.py:44:
AssertionError
----------------------------- Captured stdout call -----------------------------
Initialize configuration
.ys already exists, skip
.ys/config.ini already exists, skip
# create configuration file .ys/repo_my_repo.txt
Initialized yarsync configuration in
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build/tests/test_dir_empty/.ys
____________________________ test_init_non_existent ____________________________
mocker = <pytest_mock.plugin.MockerFixture object at 0xffffaccbde10>
def test_init_non_existent(mocker):
def _os_path_exists(filepath):
return False
m = mocker.mock_open()
mocker.patch("builtins.open", m)
mocker.patch("os.path.exists", _os_path_exists)
mkdir = mocker.patch("os.mkdir")
mocker.patch("os.listdir", lambda _: [])
args = "yarsync init myhost".split()
ys = YARsync(args)
conffile = ys.CONFIGFILE
repofile = ys.REPOFILE.format("myhost")
res = ys()
assert res == 0
call = mocker.call
assert mkdir.mock_calls == [call(YSDIR)]
# assert mkdir.mock_calls == [call(YSDIR, ys.DIRMODE)]
> assert m.mock_calls == [
# mkdir is recorded separately
call(conffile, "w"), call().__enter__(),
call().write(CONFIG_EXAMPLE), call().write(''),
call().__exit__(None, None, None),
call(repofile, "x"), call().__enter__(),
call().__exit__(None, None, None)
]
E AssertionError: assert [call('.ys/co...all().close()] ==
[call('.ys/co...t', 'x'), ...]
E
E At index 5 diff: call().close() != call('.ys/repo_myhost.txt', 'x')
E Left contains 2 more items, first extra item: call().__exit__(None,
None, None)
E Use -v to get more diff
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build/tests/test_init.py:87:
AssertionError
----------------------------- Captured stdout call -----------------------------
Initialize configuration for 'myhost'
mkdir .ys
# create configuration file .ys/config.ini
# create configuration file .ys/repo_myhost.txt
Initialized yarsync configuration in
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build/tests/test_dir_empty/.ys
=========================== short test summary info ============================
FAILED tests/test_commit.py::test_commit - assert [call().__ent...all().close...
FAILED tests/test_init.py::test_init_mixed - AssertionError: assert [call('.y...
FAILED tests/test_init.py::test_init_non_existent - AssertionError: assert [c...
========================= 3 failed, 28 passed in 1.67s =========================
E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_yarsync/build; python3.13 -m pytest
--ignore=tests/test_clone.py --ignore=tests/test_status.py
I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_yarsync/build;
python3.12 -m pytest --ignore=tests/test_clone.py --ignore=tests/test_status.py
============================= test session starts ==============================
platform linux -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
rootdir: /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_yarsync/build
configfile: pytest.ini
plugins: typeguard-4.3.0, cov-5.0.0, mock-3.14.0
collected 31 items
tests/test_commit.py ...... [ 19%]
tests/test_env_vars.py . [ 22%]
tests/test_init.py ... [ 32%]
tests/test_log.py .... [ 45%]
tests/test_pull_push.py ...... [ 64%]
tests/test_remote.py . [ 67%]
tests/test_sync.py .. [ 74%]
tests/test_ys_helpers.py ........ [100%]
============================== 31 passed in 1.66s ==============================
dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p "3.13
3.12" returned exit code 13
make: *** [debian/rules:7: binary] Error 25
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
--------------------------------------------------------------------------------
Build finished at 2024-09-19T17:00:49Z
Finished
--------
This bug has been filed at "normal" severity, as we haven't started the
transition to add 3.13 as a supported version, yet. This will be raised to RC
as soon as that happens, hopefully well before trixie.
Thanks,
Stefano
--- End Message ---