test_push_pull.py 395 B

123456789101112131415161718
  1. # coding: utf-8
  2. #
  3. import io
  4. import os
  5. import uiautomator2 as u2
  6. def test_push_and_pull(d: u2.Device):
  7. device_target = "/data/local/tmp/hello.txt"
  8. content = b"hello world"
  9. d.push(io.BytesIO(content), device_target)
  10. d.pull(device_target, "tmpfile-hello.txt")
  11. with open("tmpfile-hello.txt", "rb") as f:
  12. assert f.read() == content
  13. os.unlink("tmpfile-hello.txt")