67 Commits

Author SHA1 Message Date
Jeong YunWon
43e20a8cd9 Fix os.putenv & test_os.test_envronb 2024-07-28 16:24:17 +09:00
Jeong YunWon
85fa157d5a Update test_os from CPython v3.12.3 2024-05-09 11:51:05 +09:00
CPython Developers
a5f8d42d34 Update os from CPython 3.12.2 2024-04-23 12:56:32 +09:00
Daniel Chiquito
e6c73883ea Revert test skip 2024-03-21 13:36:28 -04:00
Daniel Chiquito
e315077630 Add TODO: RUSTPYTHON to skip reason 2024-03-21 11:31:03 -04:00
Daniel Chiquito
ac78517044 Skip TestScander.test_uninstantiable (#5204)
This test was marked as an expected failure. Because the garbage
collector is missing, that meant that the `os.scandir` object went
unclosed. This object was squatting on the file descriptors of all the
files contained in the test directory, which was breaking test_zipfile.
2024-03-21 14:44:03 +09:00
deantvv
6917b4c2ca os: ns_to_sec rounding (#5150)
In cpython, they use `_PyTime_ROUND_FLOOR` to read time.
But in RustPython, we use `[Duration::from_secs_f64](https://doc.rust-lang.org/std/time/struct.Duration.html#method.try_from_secs_f64)` to read time.

Therefore, RustPython isn't affected by the rounding issue in the way
that cpython does. We can safely ignore the `0.5*1e-9` bit in
`ns_to_sec` function.
2024-01-23 20:09:22 +09:00
Ankit Kumar Pandey
058f8c5500 Add fork support functions (#4972) 2023-06-01 15:29:16 +09:00
Ankit Kumar Pandey
322aa6887a add support for os.fork and related functions (#4877) 2023-04-25 02:39:54 +09:00
Dmitry Erlikh
a354f7bba1 Properly handle failing test_os tests on windows (#4764) 2023-04-20 14:42:16 +09:00
CPython Developers
a14593721f Update test_os from CPython 3.10.6 2022-08-15 02:36:46 +09:00
Jeong YunWon
eb0a892cc5 Use stable rust again 2022-08-14 22:08:45 +09:00
Dean Li
25a6b2b7c4 test: update test_os.py to 3.10 2022-04-18 22:58:00 +08:00
Dean Li
29c953d9a6 test: update test.support and test_io to 3.10
Initially this is only meant to be a small update for `test_io.py`.
But it turns out that `test.support` need a lot of cleanup especially
for `test.support.warnings_helper`.
2022-04-18 22:50:55 +08:00
Padraic Fanning
c8748bc98e Fix test.support imports 2022-02-13 17:56:08 -05:00
Padraic Fanning
75390dd787 Fix test.support imports 2022-02-12 20:48:57 -05:00
Dean Li
2df64f081f os: implement device_encoding 2022-02-08 07:47:57 +08:00
Dean Li
b95b580a65 test: mark os success tests 2022-01-22 22:20:04 +08:00
Dean Li
6f98288e84 test: use import_helper 2021-11-29 21:03:02 +08:00
Dean Li
5ee4fb899b test: use os_helper 2021-11-28 20:51:32 +08:00
Dean Li
39b9e1f91e test: os use os_helper 2021-11-28 20:51:32 +08:00
Jeong YunWon
913b78ca44 Revert "Merge pull request #3433 from deantvv/test-update"
This reverts commit 9fa5c5ac66, reversing
changes made to e7fa32c687.
2021-11-17 17:06:51 +09:00
Dean Li
49a5805d11 test: use os_helper 2021-11-13 02:18:33 +00:00
Dean Li
ce75d5c6a2 test: os use os_helper 2021-11-13 02:18:33 +00:00
Dean Li
86920e21e5 posix: handle case -1 for Uid and Gid
For `Uid` and `Gid`, -1 means does not change the value.
2021-10-20 22:23:36 +08:00
Dean Li
98007094f6 update doc for IOErrorBuilder 2021-10-16 22:59:25 +08:00
Dean Li
0c7246054e os: fix execv argument type 2021-09-26 00:39:04 +08:00
Dean Li
96dcd68472 os: fix stat_result test
Implement tp_new for `stat_result`

To unpack args, this PR implement a `flatten_args` closure to
unpack args like
```
args = (1, 2, 3, 4, 5)
args = ((1, 2, 3, 4, 5))
args = (((1, 2, 3, 4, 5)))  # from pickle load
```
2021-09-19 10:07:53 +08:00
Dean Li
b80db73af6 os: update TestSendfile from cpython 2021-08-11 20:58:13 +08:00
Dean Li
e1ce1e7ac4 os: fix fdopen invalid file descriptor 2021-07-26 23:00:29 +08:00
Dean Li
62f49ed4de os: Fix error message of fspath 2021-06-13 13:48:39 +08:00
Dean Li
d458669e8c os: Fix test for lstat 2021-06-13 13:47:54 +08:00
Dean Li
ff87ad052d os: Fix openpty test
Make openpty return non-inheritable file descriptors
2021-06-08 19:09:18 +08:00
Noah
bf0d71b05b Merge pull request #2674 from deantvv/os-times
os: Implement times
2021-05-26 13:46:41 -05:00
Dean Li
fda08241a4 os: Implement times
Signed-off-by: Dean Li <deantvv@gmail.com>
2021-05-26 21:49:15 +08:00
Noah
d5dbe293e0 Merge pull request #2669 from deantvv/os-listdir-optional-arg
os: argument in listdir should be optional
2021-05-24 20:21:08 -05:00
Padraic Fanning
5df4b0310d Skip flaky test on Linux 2021-05-24 18:41:58 -04:00
Dean Li
fde0431bd1 os: argument in listdir should be optional
From `listdir(path)` to `listdir(path='.')`
2021-05-24 18:12:58 +08:00
Padraic Fanning
72a54fa7ad Unmark passing tests 2021-05-20 20:50:29 -04:00
Dean Li
15427a26a5 os: Fix DirEntry is_file and is_dir function
Change `perform_on_metadata` to fit python document and tests.

From python document ->
> Return True if this entry is a directory or a symbolic link pointing to a directory;
> return False if the entry is or points to any other kind of file, or if it doesn’t exist anymore.
> ...
> This method can raise OSError, such as PermissionError, but FileNotFoundError is caught and not raised.
> - [python doc](https://docs.python.org/3/library/os.html?highlight=direntry#os.DirEntry.is_dir)
2021-05-16 12:36:17 +08:00
Dean Li
aae82422fa os: implement repr for DirEntry 2021-05-13 21:39:13 +08:00
Dean Li
e84ba9278b os: Implement inode() for class DirEntry
Use `std::os::unix::fs::DirEntryExt` on unix to get inode and
use `stat_inner` for other platfrom to get stat and cache
inode into `AtomicCell<Option<u64>>`.

Currently on windows platform in `stat_inner` inode will only contains
default value (0).
2021-05-10 22:25:57 +08:00
Dean Li
69a7f3d1cb os: symlink use FromArgs for arguments
Related to #1175
2021-04-30 20:33:17 +08:00
Noah
d8d979a420 Skip/unskip some tests on unix now 2021-04-27 08:15:13 -05:00
Dean Li
d99f4038e1 os: Fix open keyword arguments
Following code used to fail due to the way used to define
os.open in rust. To fix this, we need to use `FromArgs`
to define `struct OpenArgs {...}`.
```
f = os.open(path=__file__, flags=os.O_RDONLY, mode=0o777, dir_fd=None)
```

Noted that the original `open` is now rename to `os_open`
and is exported as `open`.

Related to #1175
2021-04-26 19:51:24 +08:00
Dean Li
89d0d5a63d os: remove symlink 3rd argument restriction 2021-04-12 21:17:04 +08:00
Dean Li
b065c059d2 os: Don't consume File in path_from_fd 2021-04-07 22:40:06 +08:00
Dean Li
7a890256aa Fix skip condition for test_fd 2021-04-04 22:34:24 +08:00
Dean Li
974ed856ba Implement os.closerange
`closerange` use `close` internally
2021-03-06 04:51:49 +00:00
Noah
ce8b5eed90 Enable dir_fd for utime, unskip a bunch of tests 2021-02-08 12:36:54 -06:00