Closed Bug 780245 Opened 12 years ago Closed 12 years ago

SUTAgent tests always use POSIX paths

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mcote, Assigned: mihneadb)

References

Details

Attachments

(1 file)

Most, if not all, the SUTAgent tests use POSIX-style paths for local file access. This means they won't execute properly on Windows. They should use os.path() for manipulating local files, and the posixpath module for manipulating files on the device (since it is a SUTAgent requirement that all paths be presented in POSIX style, regardless of the device's platform).
Assignee: nobody → mbalaur
Depends on: 778366
Switched the paths, fixed newlines, indentation, line lengths. Ugly work :(.
Attachment #648915 - Flags: review?(mcote)
Also, this patch is incremental, assumes the one in #778366 is applied.
Comment on attachment 648915 [details] [diff] [review]
fix the paths; improve the code style

Review of attachment 648915 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for doing this. :) Looks good, just tiny little nits. You can push after addressing them; no need for re-review.

::: mozdevice/sut_tests/genfiles.py
@@ +66,4 @@
>  
>  
>  def clean_test_files():
> +    ds = [os.path.join('test-files', d) for d in ['push1', 'push2']]

Tiny nit: probably more appropriate to use a tuple for ('push1', 'push2').

@@ +72,5 @@
>              shutil.rmtree(d)
>          except OSError:
>              pass
>  
> +    fs = [os.path.join('test-files', f) for f in ['mybinary.zip', 'mytext.zip']]

Same as above.

::: mozdevice/sut_tests/test_info.py
@@ +12,5 @@
> +    def runTest(self):
> +        """ This tests the "info" command
> +        """
> +        cmds = ['os', 'id', 'systime', 'uptime', 'screen',
> +                'memory', 'power', 'process']

Technically this should probably be a tuple as well.

::: mozdevice/sut_tests/test_isdir.py
@@ +22,5 @@
>          self.dm.mkDir(testdir)
>          self.assertTrue(self.dm.isDir(testdir))
> +        self.dm.pushFile(os.path.join('test-files', 'mytext.txt'),
> +                         posixpath.join(testdir, 'mytext.txt'))
> +        self.assertFalse(self.dm.isDir(posixpath.join(testdir, '/mytext.txt')))

Remove the /.
Attachment #648915 - Flags: review?(mcote) → review+
https://github.com/mozilla/mozbase/commit/ecc8c4b8f45008449f2800f2ccec95c979c28901
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: