<bdo id='iNjvx'></bdo><ul id='iNjvx'></ul>
    1. <tfoot id='iNjvx'></tfoot>

    2. <i id='iNjvx'><tr id='iNjvx'><dt id='iNjvx'><q id='iNjvx'><span id='iNjvx'><b id='iNjvx'><form id='iNjvx'><ins id='iNjvx'></ins><ul id='iNjvx'></ul><sub id='iNjvx'></sub></form><legend id='iNjvx'></legend><bdo id='iNjvx'><pre id='iNjvx'><center id='iNjvx'></center></pre></bdo></b><th id='iNjvx'></th></span></q></dt></tr></i><div id='iNjvx'><tfoot id='iNjvx'></tfoot><dl id='iNjvx'><fieldset id='iNjvx'></fieldset></dl></div>
    3. <small id='iNjvx'></small><noframes id='iNjvx'>

    4. <legend id='iNjvx'><style id='iNjvx'><dir id='iNjvx'><q id='iNjvx'></q></dir></style></legend>

      在 tox 部分自动选择平台(或其他)条件

      时间:2023-08-06

            <bdo id='PTLqN'></bdo><ul id='PTLqN'></ul>
            <i id='PTLqN'><tr id='PTLqN'><dt id='PTLqN'><q id='PTLqN'><span id='PTLqN'><b id='PTLqN'><form id='PTLqN'><ins id='PTLqN'></ins><ul id='PTLqN'></ul><sub id='PTLqN'></sub></form><legend id='PTLqN'></legend><bdo id='PTLqN'><pre id='PTLqN'><center id='PTLqN'></center></pre></bdo></b><th id='PTLqN'></th></span></q></dt></tr></i><div id='PTLqN'><tfoot id='PTLqN'></tfoot><dl id='PTLqN'><fieldset id='PTLqN'></fieldset></dl></div>

            <small id='PTLqN'></small><noframes id='PTLqN'>

              <tbody id='PTLqN'></tbody>
          • <tfoot id='PTLqN'></tfoot>
          • <legend id='PTLqN'><style id='PTLqN'><dir id='PTLqN'><q id='PTLqN'></q></dir></style></legend>

                本文介绍了在 tox 部分自动选择平台(或其他)条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我想专门运行某个 tox 部分,然后在特定平台上自动决定.如果我只运行 tox -e ALL,下面的示例代码片段可以正常工作.然后平台条件很好地划分出正确的平台.

                I want to specifically run a certain tox section which then auto-decides on the specific platform. The example code-snippet below works fine if I just ran tox -e ALL. Then the platform condition nicely sects out the correct platform.

                但是,我想处理并运行特定部分,例如 tox -e other (而不是 tox -e other-win,other-linux) 然后让 tox 自动选择相应的平台(或任何其他)条件.

                However, I want to only adress and run a specific section like for instance something like tox -e other (not tox -e other-win, other-linux) and then have tox auto-chosing the corresponding platform (or any other) condition.

                我不知道这种在 tox 中设置条件的方式是不是不可能,还是我遗漏了什么.

                I don't know if this way of setting up conditions in tox is not possible, or if I'm missing something.

                [tox]
                skipsdist = true
                
                [testenv:systest-{win, linux}]
                platform =
                    linux: linux
                    win: win|msys
                
                whitelist_externals = 
                    win: cmd
                    linux: sh
                
                commands =
                    win: cmd /r echo {env:OS}
                    linux: sh -c echo {env:OS}
                
                [testenv:other-{win, linux}]
                platform =
                    linux: linux
                    win: win|msys
                
                whitelist_externals = 
                    win: cmd
                    linux: sh
                
                commands =
                    win: cmd /r echo {env:OS}
                    linux: sh -c echo {env:OS}
                

                推荐答案

                你可以给 tox-factor插件试一试.

                You could give the tox-factor plugin a try.

                例如:

                tox.ini

                [tox]
                envlist =
                    alpha-{redmond,tux}
                    bravo-{redmond,tux}
                requires =
                    tox-factor
                skipsdist = true
                
                [testenv]
                commands =
                    python -c 'import sys; print("platform", sys.platform)'
                platform =
                    redmond: win32
                    tux: linux
                

                这给出了以下四种环境:

                This gives the following four environments:

                $ tox --listenvs
                alpha-redmond
                alpha-tux
                bravo-redmond
                bravo-tux
                

                可以根据因素来选择:

                $ tox --listenvs --factor tux
                alpha-tux
                bravo-tux
                $ tox --listenvs --factor alpha
                alpha-redmond
                alpha-tux
                

                然后像这样运行(例如在 Linux 平台上):

                And then run like this (for example on a Linux platform):

                $ tox --factor bravo
                bravo-tux run-test-pre: PYTHONHASHSEED='1770792708'
                bravo-tux run-test: commands[0] | python -c 'import sys; print("platform", sys.platform)'
                platform linux
                ________________________________________________ summary ________________________________________________
                SKIPPED:  bravo-redmond: platform mismatch ('linux' does not match 'win32')
                  bravo-tux: commands succeeded
                  congratulations :)
                

                参考文献:

                • https://github.com/tox-dev/tox/issues/1338
                • https://pypi.org/project/tox-factor/

                这篇关于在 tox 部分自动选择平台(或其他)条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:“漂亮"Python 的持续集成 下一篇:Atlassian Bamboo with Django &amp;Python - 可能吗?

                相关文章

                最新文章

              • <legend id='PmhUP'><style id='PmhUP'><dir id='PmhUP'><q id='PmhUP'></q></dir></style></legend>
                  <bdo id='PmhUP'></bdo><ul id='PmhUP'></ul>

                  1. <i id='PmhUP'><tr id='PmhUP'><dt id='PmhUP'><q id='PmhUP'><span id='PmhUP'><b id='PmhUP'><form id='PmhUP'><ins id='PmhUP'></ins><ul id='PmhUP'></ul><sub id='PmhUP'></sub></form><legend id='PmhUP'></legend><bdo id='PmhUP'><pre id='PmhUP'><center id='PmhUP'></center></pre></bdo></b><th id='PmhUP'></th></span></q></dt></tr></i><div id='PmhUP'><tfoot id='PmhUP'></tfoot><dl id='PmhUP'><fieldset id='PmhUP'></fieldset></dl></div>

                    <small id='PmhUP'></small><noframes id='PmhUP'>

                    <tfoot id='PmhUP'></tfoot>