Skip to content

Commit 955347e

Browse files
committed
posix.pathconf_names only for linux
1 parent 468f1aa commit 955347e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

extra_tests/snippets/stdlib_os.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,8 @@ def __exit__(self, exc_type, exc_val, exc_tb):
509509
assert_raises(TypeError, os.system, arg)
510510

511511
# Testing for os.pathconf_names
512-
if not sys.platform.startswith("win"):
512+
if sys.platform.startswith('linux'):
513513
assert len(os.pathconf_names) > 0
514514
assert 'PC_NAME_MAX' in os.pathconf_names
515515
for option,index in os.pathconf_names.items():
516516
assert os.pathconf('/', index) == os.pathconf('/', option)
517-

vm/src/stdlib/posix.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ pub mod module {
5050
ffi::{CStr, CString},
5151
fs, io,
5252
os::unix::{ffi as ffi_ext, io::RawFd},
53-
str::FromStr,
5453
};
55-
use strum::VariantNames;
5654
use strum_macros::{EnumString, EnumVariantNames};
5755

5856
#[pyattr]
@@ -1883,8 +1881,12 @@ pub mod module {
18831881
pathconf(PathOrFd::Fd(fd), name, vm)
18841882
}
18851883

1884+
// TODO: this is expected to be run on macOS as a unix, but somehow not.
1885+
#[cfg(target_os = "linux")]
18861886
#[pyattr]
18871887
fn pathconf_names(vm: &VirtualMachine) -> PyDictRef {
1888+
use std::str::FromStr;
1889+
use strum::VariantNames;
18881890
let pathname = vm.ctx.new_dict();
18891891
for variant in PathconfVar::VARIANTS {
18901892
// get the name of variant as a string to use as the dictionary key

0 commit comments

Comments
 (0)