Skip to content

Commit

Permalink
remove pyfftw.config.reload_config from the public API
Browse files Browse the repository at this point in the history
  • Loading branch information
grlee77 committed Sep 17, 2018
1 parent 7743304 commit ffc1d4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyfftw/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def optional_str(x):
_env_reloader = _EnvReloader()


def reload_config():
def _reload_config():
"""
Reload the configuration from environment variables, if necessary.
"""
Expand Down
14 changes: 7 additions & 7 deletions test/test_pyfftw_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_default_config(self):
os.environ.pop('OMP_NUM_THREADS', None)
os.environ.pop('PYFFTW_PLANNER_EFFORT', None)
# defaults to single-threaded and FFTW_ESTIMATE
config.reload_config()
config._reload_config()
assert_equal(config.NUM_THREADS, 1)
assert_equal(config.PLANNER_EFFORT, 'FFTW_ESTIMATE')

Expand All @@ -48,17 +48,17 @@ def test_default_threads_OpenMP(self):
os.environ.pop('OMP_NUM_THREADS', None)

# defaults to single-threaded if neither variable is defined
config.reload_config()
config._reload_config()
assert_equal(config.NUM_THREADS, 1)

# load default from OMP_NUM_THREADS environment variable
os.environ['OMP_NUM_THREADS'] = '2'
config.reload_config()
config._reload_config()
assert_equal(config.NUM_THREADS, 2)

# PYFFTW_NUM_THREADS overrides OMP_NUM_THREADS when both are defined
os.environ['PYFFTW_NUM_THREADS'] = '4'
config.reload_config()
config._reload_config()
assert_equal(config.NUM_THREADS, 4)

def test_non_default_config(self):
Expand All @@ -69,16 +69,16 @@ def test_non_default_config(self):
os.environ['PYFFTW_NUM_THREADS'] = '4'
os.environ['PYFFTW_PLANNER_EFFORT'] = 'FFTW_MEASURE'

config.reload_config()
config._reload_config()
assert_equal(config.NUM_THREADS, 4)
assert_equal(config.PLANNER_EFFORT, 'FFTW_MEASURE')

# set values to something else
config.NUM_THREADS = 6
config.PLANNER_EFFORT = 'FFTW_ESTIMATE'

# reload_config should preserve the user-defined values
config.reload_config()
# _reload_config preserves the user-defined values
config._reload_config()
assert_equal(config.NUM_THREADS, 6)
assert_equal(config.PLANNER_EFFORT, 'FFTW_ESTIMATE')

Expand Down

0 comments on commit ffc1d4d

Please sign in to comment.