From 0d8f52bce0c75cfdb842598c080119536a7278cd Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Fri, 19 Jun 2020 14:29:09 -0400 Subject: [PATCH] HACKING.rst: add strpath gotcha to testing gotchas section --- HACKING.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/HACKING.rst b/HACKING.rst index 81e6c2660ec..47ac6a86d77 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -227,6 +227,14 @@ The following guidelines should be followed: * ``tmpdir_factory`` * ``tmpdir`` + * On xenial, the objects returned by the ``tmpdir`` fixture cannot be + used where paths are required; they are rejected as invalid paths. + You must instead use their ``.strpath`` attribute. + + * For example, instead of + ``util.write_file(tmpdir.join("some_file"), ...)``, you should + write ``util.write_file(tmpdir.join("some_file").strpath, ...)``. + * Variables/parameter names for ``Mock`` or ``MagicMock`` instances should start with ``m_`` to clearly distinguish them from non-mock variables