SUTAgent tests always use POSIX paths

RESOLVED FIXED

Status

Testing
Mozbase
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: mcote, Assigned: mihneadb)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
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)

Updated

6 years ago
Assignee: nobody → mbalaur
(Assignee)

Updated

6 years ago
Depends on: 778366
(Assignee)

Comment 1

6 years ago
Created attachment 648915 [details] [diff] [review]
fix the paths; improve the code style

Switched the paths, fixed newlines, indentation, line lengths. Ugly work :(.
Attachment #648915 - Flags: review?(mcote)
(Assignee)

Comment 2

6 years ago
Also, this patch is incremental, assumes the one in #778366 is applied.
(Reporter)

Comment 3

6 years ago
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+
(Assignee)

Comment 4

6 years ago
https://github.com/mozilla/mozbase/commit/ecc8c4b8f45008449f2800f2ccec95c979c28901
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.