[PATCH 2 of 4] atomictempfile: remove test ordering

Martijn Pieters mj at zopatista.com
Thu Jun 23 13:20:11 EDT 2016


On 23 June 2016 at 17:43, Martijn Pieters <mj at zopatista.com> wrote:
> # HG changeset patch
> # User Martijn Pieters <mjpieters at fb.com>
> # Date 1466700058 -3600
> #      Thu Jun 23 17:40:58 2016 +0100
> # Node ID 3b77e79175cdbb148ad78fc6beedee4dd16bf4c0
> # Parent  f06a3b48a4b3f7beed5405e4f157c5734b68e59e
> atomictempfile: remove test ordering
>
> These tests are independent and numbering only makes it harder to add more and
> logically group them.
>
> diff --git a/tests/test-atomictempfile.py b/tests/test-atomictempfile.py
> --- a/tests/test-atomictempfile.py
> +++ b/tests/test-atomictempfile.py
> @@ -19,7 +19,7 @@
>      def tearDown(self):
>          shutil.rmtree(self._testdir, True)
>
> -    def test1_simple(self):
> +    def test_simple(self):

Of course, this triggers the check-commit guards:

+  Revision 3b77e79175cd does not comply with rules
+  ------------------------------------------------------
+  19: adds a function with foo_bar naming
+   +    def test_simple(self):
+  28: adds a function with foo_bar naming
+   +    def test_discard(self):
+  37: adds a function with foo_bar naming
+   +    def test_oops(self):
+  42: adds a function with foo_bar naming
+   +    def test_checkambig(self):

I'll update and resend, and this time really run all the tests first.

>          file = atomictempfile(self._filename)
>          self.assertFalse(os.path.isfile(self._filename))
>          tempfilename = file._tempname
> @@ -34,7 +34,7 @@
>              os.path.join(self._testdir, '.testfilename-*')))
>
>      # discard() removes the temp file without making the write permanent
> -    def test2_discard(self):
> +    def test_discard(self):
>          file = atomictempfile(self._filename)
>          (dir, basename) = os.path.split(file._tempname)
>
> @@ -46,11 +46,11 @@
>
>      # if a programmer screws up and passes bad args to atomictempfile, they
>      # get a plain ordinary TypeError, not infinite recursion
> -    def test3_oops(self):
> +    def test_oops(self):
>          self.assertRaises(TypeError, atomictempfile)
>
>      # checkambig=True avoids ambiguity of timestamp
> -    def test4_checkambig(self):
> +    def test_checkambig(self):
>          def atomicwrite(checkambig):
>              f = atomictempfile(self._filename, checkambig=checkambig)
>              f.write('FOO')
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



-- 
Martijn Pieters


More information about the Mercurial-devel mailing list