Server IP : 127.0.0.2 / Your IP : 18.117.111.63 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /opt/odoo/odoo/tools/ |
Upload File : |
# -*- coding: utf-8 -*- """ Tests for the configuration file/command-line arguments. """ # This test should be run from its directory. # TODO A configmanager object cannot parse multiple times a config file # and/or the command line, preventing to 'reload' a configuration. import os import config config_file_00 = os.path.join(os.path.dirname(__file__),'test-config-values-00.conf') # 1. No config file, no command-line arguments (a.k.a. default values) conf = config.configmanager() conf.parse_config() assert conf['osv_memory_age_limit'] == 1.0 assert os.path.join(conf['root_path'], 'addons') == conf['addons_path'] # 2. No config file, some command-line arguments conf = config.configmanager() # mess with the optparse.Option definition to allow an invalid path conf.casts['addons_path'].action = 'store' conf.parse_config(['--addons-path=/xyz/dont-exist', '--osv-memory-age-limit=2.3']) assert conf['osv_memory_age_limit'] == 2.3 assert conf['addons_path'] == '/xyz/dont-exist' # 3. Config file, no command-line arguments conf = config.configmanager() conf.parse_config(['-c', config_file_00]) assert conf['osv_memory_age_limit'] == 3.4 # 4. Config file, and command-line arguments conf = config.configmanager() conf.parse_config(['-c', config_file_00, '--osv-memory-age-limit=2.3']) assert conf['osv_memory_age_limit'] == 2.3