LandlabDoctest
[source]¶Bases: nose.plugins.doctests.Doctest
doctest_ignore
= ('setup.py',)¶name
= 'landlabdoctest'¶options
(parser, env={'MINICONDA_URL_BASE': 'https://repo.continuum.io/miniconda/Miniconda3-latest', 'rvm_version': '1.27.0 (latest)', 'TRAVIS': 'true', 'TRAVIS_REPO_SLUG': 'landlab/landlab', 'rvm_warn_clr': '\x1b[33m', 'SHELL': '/bin/bash', 'TRAVIS_PULL_REQUEST_BRANCH': '', 'TRAVIS_BRANCH': 'v1.0.3', 'TRAVIS_PULL_REQUEST_SLUG': '', 'XPC_FLAGS': '0x0', 'NVM_BIN': '/Users/travis/.nvm/versions/node/v6.0.0/bin', 'MANPATH': '/Users/travis/.nvm/versions/node/v6.0.0/share/man:/usr/share/man:/usr/local/share/man:/opt/X11/share/man:/Users/travis/.rvm/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man', 'rvm_reset_clr': '\x1b[0m', 'rvm_repos_path': '/Users/travis/.rvm/repos', 'rvm_gemsets_path': '/Users/travis/.rvm/gemsets', 'rvm_lib_path': '/Users/travis/.rvm/lib', '_system_type': 'Darwin', 'TRAVIS_SECURE_ENV_VARS': 'true', 'MY_RUBY_HOME': '/Users/travis/.rvm/rubies/ruby-2.2.5', 'rvm_gems_cache_path': '/Users/travis/.rvm/gems/cache', 'rvm_user_path': '/Users/travis/.rvm/user', '__rvm_env_loaded': '2', 'RUBY_VERSION': 'ruby-2.2.5', 'PYPI_PASS': 'solo-silver-serpent', 'rvm_gems_path': '/Users/travis/.rvm/gems', '_system_version': '10.11', 'TRAVIS_COMMIT_RANGE': '30ca561752c0^...0853b6472630', 'rvm_archive_extension': 'tar.bz2', 'CONTINUOUS_INTEGRATION': 'true', 'rvm_path': '/Users/travis/.rvm', 'rvm_default_flag': '0', 'USER': 'travis', 'NVM_IOJS_ORG_MIRROR': 'https://iojs.org/dist', 'rvm_examples_path': '/Users/travis/.rvm/examples', 'PS4': '+', 'rvm_ruby_string': 'ruby-2.2.5', 'rvm_expanding_aliases': '0', '__CF_USER_TEXT_ENCODING': '0x1F5:0x0:0x0', 'SHLVL': '1', 'TRAVIS_PULL_REQUEST_SHA': '', 'rvm_action': 'do', 'NUMPY_VERSION': '1.10', 'GIT_ASKPASS': 'echo', 'rvm_hooks_path': '/Users/travis/.rvm/hooks', 'GEM_PATH': '/Users/travis/.rvm/gems/ruby-2.2.5:/Users/travis/.rvm/gems/ruby-2.2.5@global', 'rvm_gemset_name': '', 'rvm_delete_flag': '0', 'rvm_debug_flag': '0', 'XPC_SERVICE_NAME': '0', 'TRAVIS_EVENT_TYPE': 'push', 'TRAVIS_COMMIT': '0853b647263036cf5c869c186eac78a9f8a526f9', 'PLAT': 'macosx-10.7-x86_64', 'TRAVIS_RUBY_VERSION': 'default', 'TMPDIR': '/var/folders/my/m6ynh3bn6tq06h7xr3js0z7r0000gn/T/', 'rvm_debug_clr': '\x1b[35m', 'BUILD_DOCS': '0', 'rvm_archives_path': '/Users/travis/.rvm/archives', 'TRAVIS_BUILD_NUMBER': '3087', '_system_name': 'OSX', 'rvm_help_path': '/Users/travis/.rvm/help', 'GIT_HTTP_USER_AGENT': 'travis/0.1.0 dpl/1.8.31 git/2.7.4', 'rvm_environments_path': '/Users/travis/.rvm/environments', 'rvm_error_clr': '\x1b[31m', 'PAGER': 'cat', 'TRAVIS_SUDO': 'true', 'rvm_man_path': '/Users/travis/.rvm/share/man', 'TRAVIS_BUILD_ID': '207744008', 'rvm_docs_path': '/Users/travis/.rvm/docs', 'rvm_rubies_path': '/Users/travis/.rvm/rubies', 'NVM_NODEJS_ORG_MIRROR': 'https://nodejs.org/dist', 'NVM_DIR': '/Users/travis/.nvm', 'HOME': '/Users/travis', 'TRAVIS_PULL_REQUEST': 'false', 'DISPLAY': '/private/tmp/com.apple.launchd.m9RRc02Zn3/org.macosforge.xquartz:0', 'rvm_verbose_flag': '0', 'LANG': 'en_US.UTF-8', 'Apple_PubSub_Socket_Render': '/private/tmp/com.apple.launchd.iIbGTEhfyV/Render', 'TRAVIS_TEST_RESULT': '0', 'CONDA_PREFIX': '/Users/travis/miniconda', 'ANACONDA_TOKEN': 'la-01e9d42b-c21c-4775-abc5-3476523ec1f6', 'NVM_PATH': '/Users/travis/.nvm/versions/node/v6.0.0/lib/node', 'rvm_parse_break': '1', '_system_arch': 'x86_64', 'TRAVIS_TAG': 'v1.0.3', 'CI': 'true', 'COVERALLS': '0', 'rvm_head_flag': '0', 'rvm_prefix': '/Users/travis', 'DEBIAN_FRONTEND': 'noninteractive', 'rvm_user_install_flag': '1', 'TRAVIS_COMMIT_MESSAGE': "Merge branch 'master' into release", 'IRBRC': '/Users/travis/.rvm/rubies/ruby-2.2.5/.irbrc', 'rvm_notify_clr': '\x1b[32m', 'rvm_src_path': '/Users/travis/.rvm/src', 'GEM_HOME': '/Users/travis/.rvm/gems/ruby-2.2.5', 'HAS_JOSH_K_SEAL_OF_APPROVAL': 'true', 'rvm_scripts_path': '/Users/travis/.rvm/scripts', 'rvm_wrappers_path': '/Users/travis/.rvm/wrappers', 'rvm_usr_path': '/Users/travis/.rvm/usr', 'NVM_CD_FLAGS': '', 'rvm_fuzzy_flag': '1', 'rvm_project_rvmrc': '0', 'LOGNAME': 'travis', 'PATH': '/Users/travis/.rvm/gems/ruby-2.2.5/bin:/Users/travis/.rvm/gems/ruby-2.2.5@global/bin:/Users/travis/.rvm/rubies/ruby-2.2.5/bin:/Users/travis/.rvm/bin:/Users/travis/miniconda/bin:/Users/travis/bin:/Users/travis/.local/bin:/Users/travis/.nvm/versions/node/v6.0.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin', 'rvm_patches_path': '/Users/travis/.rvm/patches', 'TRAVIS_ALLOW_FAILURE': 'false', 'next_token': 'ruby', 'TERM': 'xterm', '__array_start': '0', 'rvm_log_path': '/Users/travis/.rvm/log', 'rvm_bin_path': '/Users/travis/.rvm/bin', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.qqROUO24Io/Listeners', 'TRAVIS_JOB_NUMBER': '3087.2', 'rvm_tmp_path': '/Users/travis/.rvm/tmp', 'rvm_stored_umask': '0022', 'LC_ALL': 'en_US.UTF-8', 'TRAVIS_JOB_ID': '207744010', 'rvm_token': 'do', 'TRAVIS_PYTHON_VERSION': '2.7', 'TRAVIS_LANGUAGE': 'ruby', 'TRAVIS_BUILD_DIR': '/Users/travis/build/landlab/landlab', 'BUILD_STR': '', 'PWD': '/Users/travis/build/landlab/landlab', 'TRAVIS_OS_NAME': 'osx', 'rvm_pretty_print_flag': 'auto'})[source]¶score
= 1000¶cd
(path_to_dir)[source]¶Bases: object
Context that changes to a new directory.
Examples
>>> import os, tempfile
>>> from landlab.testing.tools import cd
Create a temporary directory for testing.
>>> test_dir = os.path.realpath(tempfile.mkdtemp())
Withing the context, we’re in the new working directory, after exiting the context we’re back where we started.
>>> this_dir = os.getcwd()
>>> with cd(test_dir) as _:
... wdir = os.getcwd()
>>> test_dir == wdir
True
>>> os.getcwd() == this_dir
True
If the new working directory does not exists, create it.
>>> new_dir = os.path.join(test_dir, 'testing.d')
>>> os.path.exists(new_dir)
False
>>> with cd(new_dir) as _:
... wdir = os.getcwd()
>>> os.path.exists(new_dir)
True
>>> wdir == new_dir
True
>>> os.getcwd() == this_dir
True
cdtemp
(**kwds)[source]¶Bases: object
Context that creates and changes to a temporary directory.
Examples
>>> import os
>>> from landlab.testing.tools import cdtemp
Change to the newly-created temporary directory after entering the context. Upon exiting, remove the temporary directory and return to the original working directory.
>>> this_dir = os.getcwd()
>>> with cdtemp() as tdir:
... wdir = os.getcwd()
>>> this_dir == os.getcwd()
True
>>> os.path.exists(wdir)
False