Skip to content

Commit 6dca9db

Browse files
committed
Rename test function & fix a bug with default value handling
1 parent 040fac0 commit 6dca9db

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

ports/unix/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,11 +421,11 @@ STATIC void set_sys_argv(char *argv[], int argc, int start_arg) {
421421
#endif
422422

423423
mp_obj_t common_hal_os_getenv_path(const char *path, const char *key, mp_obj_t default_);
424-
STATIC mp_obj_t get_key(mp_obj_t path_in, mp_obj_t key_to_get_in) {
424+
STATIC mp_obj_t getenv_from_file(mp_obj_t path_in, mp_obj_t key_to_get_in) {
425425
return common_hal_os_getenv_path(mp_obj_str_get_str(path_in),
426-
mp_obj_str_get_str(key_to_get_in), mp_const_none);
426+
mp_obj_str_get_str(key_to_get_in), default_);
427427
}
428-
MP_DEFINE_CONST_FUN_OBJ_2(get_key_obj, get_key);
428+
MP_DEFINE_CONST_FUN_OBJ_2(getenv_from_file_obj, get_key);
429429

430430
MP_NOINLINE int main_(int argc, char **argv);
431431

@@ -547,7 +547,7 @@ MP_NOINLINE int main_(int argc, char **argv) {
547547
MP_DECLARE_CONST_FUN_OBJ_0(extra_cpp_coverage_obj);
548548
mp_store_global(MP_QSTR_extra_coverage, MP_OBJ_FROM_PTR(&extra_coverage_obj));
549549
mp_store_global(MP_QSTR_extra_cpp_coverage, MP_OBJ_FROM_PTR(&extra_cpp_coverage_obj));
550-
mp_store_global(MP_QSTR_get_key, MP_OBJ_FROM_PTR(&get_key_obj));
550+
mp_store_global(MP_QSTR_getenv_from_file, MP_OBJ_FROM_PTR(&getenv_from_file_obj));
551551
}
552552
#endif
553553

tests/circuitpython/environ_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22

33
try:
4-
get_key
4+
getenv_from_file
55
except NameError:
66
# Because run-tests.py suppresses site-packages, this test can't be run
77
# on the host interpreter. However, it can be run manually to
@@ -10,7 +10,7 @@
1010
# After 3.11 becomes standard, change this to use tomllib.
1111
import tomlkit
1212

13-
def get_key(filename, key):
13+
def getenv_from_file(filename, key):
1414
with open(filename) as f:
1515
s = tomlkit.load(f)
1616
return s.get(key, None)

0 commit comments

Comments
 (0)