Commit Graph

41 Commits

Author SHA1 Message Date
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
Noah
daa0b1824f Unskip tests 2021-02-07 19:39:36 -06:00
Noah
7c58f4a0c8 Fast locals part 3 2020-12-05 16:36:35 -06:00
Noah
916bb4cf1c Fix some other tests 2020-11-06 17:37:52 -06:00
Noah
7d45672f4e Skip unrelated test in test_os 2020-10-27 22:14:07 -05:00
Kangzhi Shi
cf3572385c Fix more to pass unittest 2020-10-10 17:00:57 +09:00
Noah
32272abf4d Fix/skip some failing tests 2020-09-19 00:20:51 -05:00
hyperbora
92d8e2c8da add os.getcwdb function 2020-08-30 14:56:28 +09:00
Minjun Shin
1011f48012 Implement os.execve for unix system 2020-08-12 14:19:22 +09:00
Yi Hyunjoon
10b5c2f078 Patch for ubuntu-latest CI 2020-08-09 17:36:36 +09:00
Yi Hyunjoon
70e4ee92bd Expect failure for tests raise various errors 2020-08-09 16:33:26 +09:00
Yi Hyunjoon
7a3ebfcd95 Comment EnvironTests class 2020-08-09 16:33:26 +09:00
Yi Hyunjoon
e4770ebdf1 Expect failrure for tests raise TypeError 2020-08-09 16:33:25 +09:00
Yi Hyunjoon
35667e7a48 Expect failure for failed tests 2020-08-09 16:33:25 +09:00
Yi Hyunjoon
1f1e2ee001 Expect failure for tests raise AttributeError 2020-08-09 16:33:25 +09:00
Yi Hyunjoon
06176954b1 Skip tests that raise invalid mode: x 2020-08-09 16:33:25 +09:00
Yi Hyunjoon
74fe9d30d2 Skip tests that use mmap 2020-08-09 16:33:25 +09:00
Yi Hyunjoon
d31497bb34 Copy test_os.py from CPython 3.8.3 2020-08-09 16:33:24 +09:00