November 16, 2020How to Configure Git for Testingbatou is a configuration management and deployment tool, comparable to Ansible. With batou you can deploy applications, also from git repositories. For this batou uses the git binary - so this has to be tested somehow. One test looks like this… def test_git_remote_init_pull(tmpdir): source = tmpdir.mkdir("source") dest = tmpdir.mkdir("dest") with source.as_cwd(): remote_core.cmd("git init") source.join("foo.txt").write("bar") remote_core.cmd("git add foo.txt") remote_core.cmd("git commit -m bar") remote_core.ensure_repository(str(dest), "git-bundle") remote_core.git_pull_code(str(source), "master") remote_core.git_update_working_copy("master") assert "bar" == dest.join("foo.txt").read() … and worked in some environments, even on Travis, but failed on my Ubuntu box, and later also on GH Actions:...
September 28, 2020How to Run a Single TestWhile this seems to be no Zope specific question, as we all know how to narrow down the test selection with pytest (e.g. pytest -k pattern), Zope does not use pytest, but zope.testrunner. Similar to pytest, also zope.testrunner offers some command line options, see https://zopetestrunner.readthedocs.io/en/latest/getting-started.html#some-useful-command-line-options-to-get-you-started This means, in order to run a specific test, you can use the -t flag, which takes one or more regex expressions as input, e.g. -t some_test....