10 new commits in tox: https://bitbucket.org/hpk42/tox/commits/cd64bee5b235/ Changeset: cd64bee5b235 User: lukaszb Date: 2013-06-14 18:24:17 Summary: Created initial documentation for development environments -- related with #101 Affected #: 2 files
diff -r 1c746939df7f57bae11fe81010446d5c8dc3dae6 -r cd64bee5b235661b8b2dc13294a6cc55603a6812 doc/example/devenv.txt --- /dev/null +++ b/doc/example/devenv.txt @@ -0,0 +1,64 @@ + +Development environment +======================= + +Tox can be used to prepare development virtual environment for local projects. +This feature can be useful in order to preserve environment across team members +working on same project. It can be also used by deployment tools to prepare +proper environments. + +*devenv* would be created at specific directory, not within ``.tox`` directory +as other test environments. Other than that, configuration for this environment +is very similar to other tox envs. + + +Configuration +------------- + +Firstly, you need to prepare configuration for your development environment. In +order to do that, we must define proper section at ``tox.ini`` file and tell at +what directory environment should be created. Moreover, we need to specify +python version that should be picked:: + + [devenv] + envdir = devenv + basepython = python2.7 + + +Actually, you can configure a lot more, those are the only required settings. +In example you can add ``deps`` and ``commands`` settings. + + +.. note:: ``envdir`` should be *relative* path to where ``tox.ini`` is located. + + +Creating development environment +-------------------------------- + +Once ``devenv`` section is defined we can instrument tox to create our +environment:: + + tox --devenv + +This will create an environment at path specified by ``envdir`` under ``devenv`` +section. + + + +Full configuration example +-------------------------- + +Let's say we want our development environment sit at ``devenv``. We create this +directory manually and put ``requirements.txt`` file there. We want to work on +Python 2.7. + +Here is example configuration for that:: + + [devenv] + envdir = devenv + changedir = devenv + basepython = python2.7 + commands = + pip install -r requirements.txt + + diff -r 1c746939df7f57bae11fe81010446d5c8dc3dae6 -r cd64bee5b235661b8b2dc13294a6cc55603a6812 doc/examples.txt --- a/doc/examples.txt +++ b/doc/examples.txt @@ -11,4 +11,5 @@ example/nose.txt example/general.txt example/jenkins.txt + example/devenv.txt https://bitbucket.org/hpk42/tox/commits/8b6f18ce8d64/ Changeset: 8b6f18ce8d64 User: lukaszb Date: 2013-06-20 20:31:16 Summary: Updated documentation for development environment Affected #: 2 files diff -r cd64bee5b235661b8b2dc13294a6cc55603a6812 -r 8b6f18ce8d64eff4e9b3776a7553e8231d7a6ec1 doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -163,6 +163,14 @@ (including when installing the project sdist package). +.. confval:: envdir + + .. versionadded:: 1.5 + + User can set specific path for environment. If path would not be absolute it + would be treated as relative to ``{toxinidir}``. **default**: + ``{toxworkdir}/{envname}`` + Substitutions --------------------- diff -r cd64bee5b235661b8b2dc13294a6cc55603a6812 -r 8b6f18ce8d64eff4e9b3776a7553e8231d7a6ec1 doc/example/devenv.txt --- a/doc/example/devenv.txt +++ b/doc/example/devenv.txt @@ -20,7 +20,7 @@ what directory environment should be created. Moreover, we need to specify python version that should be picked:: - [devenv] + [testenv:devenv] envdir = devenv basepython = python2.7 @@ -38,10 +38,10 @@ Once ``devenv`` section is defined we can instrument tox to create our environment:: - tox --devenv + tox -e devenv --envonly -This will create an environment at path specified by ``envdir`` under ``devenv`` -section. +This will create an environment at path specified by ``envdir`` under +``[testenv:devenv]`` section. @@ -54,7 +54,7 @@ Here is example configuration for that:: - [devenv] + [testenv:devenv] envdir = devenv changedir = devenv basepython = python2.7 https://bitbucket.org/hpk42/tox/commits/9c8a6ba3a8c0/ Changeset: 9c8a6ba3a8c0 User: lukaszb Date: 2013-06-20 21:05:30 Summary: Added tests for envdir config Affected #: 1 file diff -r 8b6f18ce8d64eff4e9b3776a7553e8231d7a6ec1 -r 9c8a6ba3a8c0913d582da4ed9b1913e8d0664fde tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -44,6 +44,22 @@ assert dep2.indexserver.name == "xyz" assert dep2.indexserver.url == "xyz_repo" + def test_envdir_set_manually(self, tmpdir, newconfig): + config = newconfig([], """ + [testenv:devenv] + envdir = devenv + """) + envconfig = config.envconfigs['devenv'] + assert envconfig.envdir == tmpdir.join('devenv') + + def test_envdir_set_manually_with_substitutions(self, tmpdir, newconfig): + config = newconfig([], """ + [testenv:devenv] + envdir = {toxworkdir}/foobar + """) + envconfig = config.envconfigs['devenv'] + assert envconfig.envdir == config.toxworkdir.join('foobar') + class TestConfigPackage: def test_defaults(self, tmpdir, newconfig): config = newconfig([], "") https://bitbucket.org/hpk42/tox/commits/20ef6ad9ee7d/ Changeset: 20ef6ad9ee7d User: lukaszb Date: 2013-06-20 22:06:49 Summary: Dropped note from devenv - envdir is now better documented at config.txt Affected #: 1 file diff -r 9c8a6ba3a8c0913d582da4ed9b1913e8d0664fde -r 20ef6ad9ee7d952a603c7449b3478ad6b00f28b2 doc/example/devenv.txt --- a/doc/example/devenv.txt +++ b/doc/example/devenv.txt @@ -29,8 +29,6 @@ In example you can add ``deps`` and ``commands`` settings. -.. note:: ``envdir`` should be *relative* path to where ``tox.ini`` is located. - Creating development environment -------------------------------- https://bitbucket.org/hpk42/tox/commits/64a59fad08de/ Changeset: 64a59fad08de User: lukaszb Date: 2013-06-20 22:13:01 Summary: Removed --envonly switch from devenv docs Affected #: 1 file diff -r 20ef6ad9ee7d952a603c7449b3478ad6b00f28b2 -r 64a59fad08de78bdc58fa941eba29b37eeb8f9f8 doc/example/devenv.txt --- a/doc/example/devenv.txt +++ b/doc/example/devenv.txt @@ -36,7 +36,7 @@ Once ``devenv`` section is defined we can instrument tox to create our environment:: - tox -e devenv --envonly + tox -e devenv This will create an environment at path specified by ``envdir`` under ``[testenv:devenv]`` section. https://bitbucket.org/hpk42/tox/commits/a8b1cc2184d5/ Changeset: a8b1cc2184d5 User: lukaszb Date: 2013-06-20 23:20:02 Summary: Documented 'package' config for test envs Affected #: 2 files diff -r 64a59fad08de78bdc58fa941eba29b37eeb8f9f8 -r a8b1cc2184d5241ce0df85e06c4d7a07637f2e91 doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -171,6 +171,16 @@ would be treated as relative to ``{toxinidir}``. **default**: ``{toxworkdir}/{envname}`` + +.. confval:: package=BOOL + + .. versionadded:: 1.5 + + Set to ``False`` if you don't want tox to perform package-related steps + (building source distribution and installing it). Might be useful for + non-package projects (i.e. all that lacks ``setup.py`` file). **default**: + ``True``. + Substitutions --------------------- diff -r 64a59fad08de78bdc58fa941eba29b37eeb8f9f8 -r a8b1cc2184d5241ce0df85e06c4d7a07637f2e91 doc/example/devenv.txt --- a/doc/example/devenv.txt +++ b/doc/example/devenv.txt @@ -18,11 +18,13 @@ Firstly, you need to prepare configuration for your development environment. In order to do that, we must define proper section at ``tox.ini`` file and tell at what directory environment should be created. Moreover, we need to specify -python version that should be picked:: +python version that should be picked and tell tox not to perform any package +related steps:: [testenv:devenv] envdir = devenv basepython = python2.7 + package = False Actually, you can configure a lot more, those are the only required settings. @@ -53,6 +55,7 @@ Here is example configuration for that:: [testenv:devenv] + package = False envdir = devenv changedir = devenv basepython = python2.7 https://bitbucket.org/hpk42/tox/commits/0eacb212fed4/ Changeset: 0eacb212fed4 User: lukaszb Date: 2013-06-20 23:42:02 Summary: Added package flag to venv config Affected #: 2 files diff -r a8b1cc2184d5241ce0df85e06c4d7a07637f2e91 -r 0eacb212fed4a9fce77fd6ffc2cf2dd619387835 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -60,6 +60,20 @@ envconfig = config.envconfigs['devenv'] assert envconfig.envdir == config.toxworkdir.join('foobar') + def test_package_flag(self, tmpdir, newconfig): + config = newconfig([], """ + [testenv:py27] + """) + envconfig = config.envconfigs['py27'] + assert envconfig.package == True + + config = newconfig([], """ + [testenv:py27] + package = False + """) + envconfig = config.envconfigs['py27'] + assert envconfig.package == False + class TestConfigPackage: def test_defaults(self, tmpdir, newconfig): config = newconfig([], "") diff -r a8b1cc2184d5241ce0df85e06c4d7a07637f2e91 -r 0eacb212fed4a9fce77fd6ffc2cf2dd619387835 tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -256,6 +256,7 @@ reader = IniReader(self._cfg, fallbacksections=["testenv"]) reader.addsubstitions(**subs) vc.envdir = reader.getpath(section, "envdir", "{toxworkdir}/%s" % name) + vc.package = reader.getbool(section, "package", True) vc.args_are_paths = reader.getbool(section, "args_are_paths", True) if reader.getdefault(section, "python", None): raise tox.exception.ConfigError( https://bitbucket.org/hpk42/tox/commits/eacb5ca142ab/ Changeset: eacb5ca142ab User: lukaszb Date: 2013-07-10 23:21:14 Summary: Simplified devenv example docs to use only existing interfaces. Affected #: 1 file diff -r 0eacb212fed4a9fce77fd6ffc2cf2dd619387835 -r eacb5ca142abf0b855d9ed2f8d61857b43ced268 doc/example/devenv.txt --- a/doc/example/devenv.txt +++ b/doc/example/devenv.txt @@ -7,10 +7,6 @@ working on same project. It can be also used by deployment tools to prepare proper environments. -*devenv* would be created at specific directory, not within ``.tox`` directory -as other test environments. Other than that, configuration for this environment -is very similar to other tox envs. - Configuration ------------- @@ -18,18 +14,18 @@ Firstly, you need to prepare configuration for your development environment. In order to do that, we must define proper section at ``tox.ini`` file and tell at what directory environment should be created. Moreover, we need to specify -python version that should be picked and tell tox not to perform any package -related steps:: +python version that should be picked:: [testenv:devenv] envdir = devenv basepython = python2.7 - package = False + commands = + deps = Actually, you can configure a lot more, those are the only required settings. -In example you can add ``deps`` and ``commands`` settings. - +In example you can add ``deps`` and ``commands`` settings. Here, we tell tox +not to pick ``commands`` or ``deps`` from base ``testenv`` configuration. Creating development environment @@ -44,22 +40,18 @@ ``[testenv:devenv]`` section. - Full configuration example -------------------------- -Let's say we want our development environment sit at ``devenv``. We create this -directory manually and put ``requirements.txt`` file there. We want to work on -Python 2.7. +Let's say we want our development environment sit at ``devenv`` and pull +packages from ``requirements.txt`` file which we create at the same directory +as ``tox.ini`` file. We also want to speciy Python version to be 2.7. Here is example configuration for that:: [testenv:devenv] - package = False envdir = devenv - changedir = devenv basepython = python2.7 commands = pip install -r requirements.txt - https://bitbucket.org/hpk42/tox/commits/ecb095208e42/ Changeset: ecb095208e42 User: lukaszb Date: 2013-07-10 23:57:04 Summary: Removed obsolates from devenv doc Affected #: 3 files diff -r eacb5ca142abf0b855d9ed2f8d61857b43ced268 -r ecb095208e429b8df180c36b4c8e8422acca89a7 doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -172,15 +172,6 @@ ``{toxworkdir}/{envname}`` -.. confval:: package=BOOL - - .. versionadded:: 1.5 - - Set to ``False`` if you don't want tox to perform package-related steps - (building source distribution and installing it). Might be useful for - non-package projects (i.e. all that lacks ``setup.py`` file). **default**: - ``True``. - Substitutions --------------------- diff -r eacb5ca142abf0b855d9ed2f8d61857b43ced268 -r ecb095208e429b8df180c36b4c8e8422acca89a7 doc/example/devenv.txt --- a/doc/example/devenv.txt +++ b/doc/example/devenv.txt @@ -52,6 +52,7 @@ [testenv:devenv] envdir = devenv basepython = python2.7 + deps = commands = pip install -r requirements.txt diff -r eacb5ca142abf0b855d9ed2f8d61857b43ced268 -r ecb095208e429b8df180c36b4c8e8422acca89a7 tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -256,7 +256,6 @@ reader = IniReader(self._cfg, fallbacksections=["testenv"]) reader.addsubstitions(**subs) vc.envdir = reader.getpath(section, "envdir", "{toxworkdir}/%s" % name) - vc.package = reader.getbool(section, "package", True) vc.args_are_paths = reader.getbool(section, "args_are_paths", True) if reader.getdefault(section, "python", None): raise tox.exception.ConfigError( https://bitbucket.org/hpk42/tox/commits/d0fe35302b52/ Changeset: d0fe35302b52 User: hpk42 Date: 2013-07-11 11:13:15 Summary: Merged in lukaszb/tox (pull request #45) Created initial documentation for development environments -- related with #101 Affected #: 5 files diff -r 63d37ba9cc8babe926e45f9e8294841148b0451b -r d0fe35302b524186be561fdba90f5a0acc81df92 doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -176,6 +176,15 @@ (including when installing the project sdist package). +.. confval:: envdir + + .. versionadded:: 1.5 + + User can set specific path for environment. If path would not be absolute it + would be treated as relative to ``{toxinidir}``. **default**: + ``{toxworkdir}/{envname}`` + + Substitutions --------------------- diff -r 63d37ba9cc8babe926e45f9e8294841148b0451b -r d0fe35302b524186be561fdba90f5a0acc81df92 doc/example/devenv.txt --- /dev/null +++ b/doc/example/devenv.txt @@ -0,0 +1,58 @@ + +Development environment +======================= + +Tox can be used to prepare development virtual environment for local projects. +This feature can be useful in order to preserve environment across team members +working on same project. It can be also used by deployment tools to prepare +proper environments. + + +Configuration +------------- + +Firstly, you need to prepare configuration for your development environment. In +order to do that, we must define proper section at ``tox.ini`` file and tell at +what directory environment should be created. Moreover, we need to specify +python version that should be picked:: + + [testenv:devenv] + envdir = devenv + basepython = python2.7 + commands = + deps = + + +Actually, you can configure a lot more, those are the only required settings. +In example you can add ``deps`` and ``commands`` settings. Here, we tell tox +not to pick ``commands`` or ``deps`` from base ``testenv`` configuration. + + +Creating development environment +-------------------------------- + +Once ``devenv`` section is defined we can instrument tox to create our +environment:: + + tox -e devenv + +This will create an environment at path specified by ``envdir`` under +``[testenv:devenv]`` section. + + +Full configuration example +-------------------------- + +Let's say we want our development environment sit at ``devenv`` and pull +packages from ``requirements.txt`` file which we create at the same directory +as ``tox.ini`` file. We also want to speciy Python version to be 2.7. + +Here is example configuration for that:: + + [testenv:devenv] + envdir = devenv + basepython = python2.7 + deps = + commands = + pip install -r requirements.txt + diff -r 63d37ba9cc8babe926e45f9e8294841148b0451b -r d0fe35302b524186be561fdba90f5a0acc81df92 doc/examples.txt --- a/doc/examples.txt +++ b/doc/examples.txt @@ -11,4 +11,5 @@ example/nose.txt example/general.txt example/jenkins.txt + example/devenv.txt diff -r 63d37ba9cc8babe926e45f9e8294841148b0451b -r d0fe35302b524186be561fdba90f5a0acc81df92 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -44,6 +44,36 @@ assert dep2.indexserver.name == "xyz" assert dep2.indexserver.url == "xyz_repo" + def test_envdir_set_manually(self, tmpdir, newconfig): + config = newconfig([], """ + [testenv:devenv] + envdir = devenv + """) + envconfig = config.envconfigs['devenv'] + assert envconfig.envdir == tmpdir.join('devenv') + + def test_envdir_set_manually_with_substitutions(self, tmpdir, newconfig): + config = newconfig([], """ + [testenv:devenv] + envdir = {toxworkdir}/foobar + """) + envconfig = config.envconfigs['devenv'] + assert envconfig.envdir == config.toxworkdir.join('foobar') + + def test_package_flag(self, tmpdir, newconfig): + config = newconfig([], """ + [testenv:py27] + """) + envconfig = config.envconfigs['py27'] + assert envconfig.package == True + + config = newconfig([], """ + [testenv:py27] + package = False + """) + envconfig = config.envconfigs['py27'] + assert envconfig.package == False + class TestConfigPackage: def test_defaults(self, tmpdir, newconfig): config = newconfig([], "") Repository URL: https://bitbucket.org/hpk42/tox/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ pytest-commit mailing list pytest-commit@python.org http://mail.python.org/mailman/listinfo/pytest-commit