Mike McLean
26f0e3e98a
drop obsolete mock
2025-04-17 10:10:53 -04:00
Mike McLean
d970eeeb5d
fix unit tests
2025-04-17 10:10:53 -04:00
Tomas Kopecek
3a4029a097
Update py2 tests
...
Py2 test updates for https://pagure.io/koji/pull-request/4214
Related: https://pagure.io/koji/issue/4248
2025-01-08 12:53:24 +01:00
Yuming Zhu
c8a27e525a
unittest: enabling tests/test_lib for py2
2025-01-06 10:55:41 +01:00
Mike McLean
e1b55ec23c
add unit test
2024-11-20 15:37:07 +01:00
Jana Librova
729c954f3d
Fix for reading config files when contains UTF-8 chars
...
Fixes: https://pagure.io/koji/issue/4191
2024-11-13 20:12:18 +01:00
Yuming Zhu
ca05418fb5
unittest: use unittest.mock instead of mock
...
because the absence of unittest.mock on python2.7, we still fallback to
mock
2024-10-23 16:35:30 +00:00
Mike McLean
6002373ff9
avoid leaving stray temp files
2024-07-18 14:22:43 +02:00
Tomas Kopecek
5801ac8b13
tests: py3 versions compatibility fixes
2024-05-06 13:17:48 +02:00
Mike McLean
4dd0e24b00
correct a few comment lines
2024-04-10 11:20:15 +02:00
Mike McLean
ce4718f1fb
fix samefile check and relative path test
2024-04-10 11:20:15 +02:00
Mike McLean
e8ae18fcc8
Align our cwd tracking with os
2024-04-10 11:20:15 +02:00
Mike McLean
c0917955c0
more testcases
2024-04-10 11:20:15 +02:00
Mike McLean
4fddafc54d
rmtree: use fork
...
These changes work around a thread safety issue in our rmtree
implementation, which uses chdir to traverse the directory tree.
Using chdir resolves issues deleting paths longer than PATH_MAX, but
makes the code inherently unsafe in a threaded environment.
Now, the main rmtree function uses fork to perform the actions in a
dedicated process.
To avoid possible locking issues with the logging module, we introduce a
simple proxy logger for the subprocess.
Fixes: https://pagure.io/koji/issue/3755
For historical context see:
https://pagure.io/koji/issue/201
https://pagure.io/koji/issue/2481
https://pagure.io/koji/issue/2714
2024-04-10 11:20:15 +02:00
Tomas Kopecek
41869961f6
Remove six.configparser.SafeConfingParser from tests
...
Fixes: https://pagure.io/koji/issue/3939
2023-11-09 13:58:53 +01:00
Tomas Kopecek
0c58cd954d
Retrieve task_id for older OSBS builds
...
Related: https://pagure.io/koji/issue/3906
2023-10-23 14:24:16 +02:00
Mike McLean
6455974fd5
adjust unit tests for new args
2023-05-17 09:35:11 +02:00
Tomas Kopecek
2daa71614e
fix tests according to pytests warnings
2022-10-24 10:40:50 +02:00
Tomas Kopecek
9e741bfb9e
beautify logged commands issued by koji
...
Related: https://pagure.io/koji/issue/929
2022-07-19 13:23:57 +02:00
Jana Cupova
c310d6692d
Pytest instead of nose in unittest
...
Fixes: https://pagure.io/koji/issue/3140
2021-12-06 12:17:29 +01:00
Tomas Kopecek
c587eb81bf
Fix tests on centos 8
...
Fixes: https://pagure.io/koji/issue/2924
2021-06-22 13:17:10 +02:00
Mike McLean
362c3e5cc6
more rmtree unit tests
2021-03-18 15:46:16 +01:00
Mike McLean
08139a9e39
update unit tests
2021-03-18 15:46:16 +01:00
Tomas Kopecek
96ae0ecef5
explicit encoding for text file operations
...
Fixes: https://pagure.io/koji/issue/2641
2021-01-26 13:36:25 +01:00
Tomas Kopecek
8ff5759b21
lib: better argument checking for eventFromOpts
...
Fixes: https://pagure.io/koji/issue/2513
2021-01-04 10:43:30 +01:00
Tomas Kopecek
b030b46f74
remove unittest2
2020-10-06 15:00:23 +02:00
Yu Ming Zhu
52a63f732d
util: [rmtree] try best to catch errors for race condition
...
fixes : #2481
This approach is ugly, but just working.
ENOENT and ESTALE errors are catched in `chdir`, `listdir` calls to stomach the deletion by other process/thread
ENOTEMPTY is catched when calling `os.rmdir(path)` in `rmtree()` too. It happens when `path` is on an NFS like where ESTALE happens.
2020-10-05 10:14:34 +02:00
Ken Dreyer
e35b571196
util: handle ENOENT in _stripcwd() listdir loop
...
After we call listdir(), another thread or process might delete files
from the current directory. We cannot always expect lstat() to succeed
in a loop over the initial listdir entries.
If lstat() raises ENOENT, consider this file deleted and move on.
2020-08-27 13:36:27 +02:00
Tomas Kopecek
a4863c0f26
lib: check consistency of rpm from openRemoteFile
...
Fixes: https://pagure.io/koji/issue/2130
2020-06-05 10:58:38 +02:00
Tomas Kopecek
8ea4a7245b
lib: retry openRemoteFile and check size
2020-06-05 10:58:38 +02:00
Tomas Kopecek
aad9fac8d9
move from urrlib.request.urlopen to requests.get
...
Fixes: https://pagure.io/koji/issue/1530
2019-11-25 11:31:08 +01:00
Yuming Zhu
b2b8d5f9cc
strict per item in config_files
2019-10-15 09:14:16 +02:00
Yu Ming Zhu
4c1928f377
extract read_config_files util for config parsing
2019-10-15 09:14:16 +02:00
Mike McLean
f0cdeaab07
tests for joinpath
2019-10-09 08:41:15 -04:00
Tomas Kopecek
6fd33bfd1f
use LANG=C for running tests comparing human-readable output
2019-06-26 15:58:48 -04:00
Yu Ming Zhu
dc208d0555
fix invokings and unittests
2019-02-17 21:26:13 -05:00
Yu Ming Zhu
9ddae41877
using ConfigParser.read_file for PY3
2019-02-17 21:26:13 -05:00
Tomas Kopecek
9963877545
move move_and_symlink to koji.util
2018-11-28 16:27:30 -05:00
Tomas Kopecek
caae1a0a8b
workaround unnecessary list conversions
2018-07-11 17:37:40 -04:00
Tomas Kopecek
bcee24e50c
python-modernize -f libmodernize.fixes.fix_dict_six
2018-07-11 17:37:39 -04:00
Tomas Kopecek
c68396c059
Use unittest2 for rhel6 compatibility
...
Fixes: https://pagure.io/koji/issue/830
2018-06-07 09:39:39 -04:00
Tomas Kopecek
2eff45f763
Drop pre-2.6 compat function koji.util._relpath
...
Fixes: https://pagure.io/koji/issue/818
2018-03-08 10:23:44 -05:00
Yuming Zhu
377fecbbfc
fix unit test - test_formatChangelog
2017-12-06 14:08:37 +08:00
Mike McLean
1da06800cf
adjustments to test_formatChangelog
2017-12-06 13:32:51 +08:00
Franz Chih-Ping Hsieh
efe68e54df
- add unit test for koji/util: (coverage 58%->100%)
...
- minor fix: check if input string time is valid
2017-11-07 09:58:21 -05:00
Tomas Kopecek
5b23fb1629
consolidate safe_rmtree, rmtree and shutil.rmtree
...
shutil.rmtree should be avoided in almost all cases
safe_rmtree has its usage in tasks module, but innards are replaced with
koji.util.rmtree, so we don't have two implementations of same task
Related: https://pagure.io/koji/issue/648
2017-10-30 12:09:04 -04:00
Mike McLean
c4a48efd83
move lib tests into subdir
2017-06-01 09:39:24 +02:00