Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ampy test fails on windows. #72

Open
youngsu999 opened this issue Dec 16, 2018 · 1 comment
Open

ampy test fails on windows. #72

youngsu999 opened this issue Dec 16, 2018 · 1 comment

Comments

@youngsu999
Copy link

youngsu999 commented Dec 16, 2018

Test filas on windows 10 test_run_without_output test function

$ python test_files.py
..file-0
file-1
.file-0
file-1
file-2
.file-0
file-1
file-2
..........E
======================================================================
ERROR: test_run_without_output (__main__.TestFiles)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_files.py", line 166, in test_run_without_output
    output = board_files.run(program.name, wait_output=False)
  File "C:\Users\youngsu\Anaconda3\lib\site-packages\adafruit_ampy-1.0.8.dev0+g2f7148f.d20181216-py3.6.egg\ampy\files.py", line 310, in run
    with open(filename, "rb") as infile:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\youngsu\\AppData\\Local\\Temp\\tmpso7llnh4'

----------------------------------------------------------------------
Ran 15 tests in 0.017s

FAILED (errors=1)

I found some related article and modified the test code.

    def test_run_without_output(self):
->      import os
        pyboard = mock.Mock()
        pyboard.exec_raw_no_follow = mock.Mock()
        board_files = files.Files(pyboard)
->      with tempfile.NamedTemporaryFile(delete=False) as program:
            program.write(b'print("Hello world")')
            program.flush()
            output = board_files.run(program.name, wait_output=False)
        self.assertEqual(output, None)
        pyboard.exec_raw_no_follow.assert_called_once_with(b'print("Hello world")')
->      os.remove(program.name)

Should we fix the tests for Windows on main branch?

@youngsu999 youngsu999 changed the title ampy fails test on windows. ampy test fails on windows. Dec 16, 2018
@ladyada
Copy link
Collaborator

ladyada commented Jan 21, 2019

Hiya! We are discontinuing support for ampy, and will no longer be maintaining it. We are leaving this repository available for continued use. If you would like to take over supporting it, please contact us on the Adafruit Discord server and we can transfer the repository to you.
If you wish to continue developing it on your own, please fork the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants