Closed sweep-nightly[bot] closed 9 months ago
tests/test_main.py
. ✗
Sandbox logs for
trunk fmt tests/test_main.py || return 0
1/3 ✓✔ Formatted tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures tests/test_main.py
2/3 ✓✔ Auto-fixed tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues
pytest
3/3 ❌ (`1`)============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 18 items tests/test_main.py sF [ 11%] tests/test_session.py ..... [ 38%] tests/test_typing_practice.py ...... [ 72%] tests/test_user.py ..... [100%] =================================== FAILURES =================================== __________________ TestMainFunction.test_main_invalid_choice ___________________ self =mock_TypingPractice = mock_User_load = @patch("touch_typing_practice.main.User.load") @patch("touch_typing_practice.main.TypingPractice") def test_main_invalid_choice(self, mock_TypingPractice, mock_User_load): mock_stdscr = MagicMock() mock_stdscr.getstr.side_effect = [ b"username", b"invalid choice", b"1", b"sample text", b"typed sample text", b"3", ] mock_User_load.return_value = MagicMock() mock_TypingPractice.return_value = create_autospec(TypingPractice) > main(mock_stdscr) tests/test_main.py:55: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ stdscr = def main(stdscr): # Clear screen stdscr.clear() > curses.echo() E _curses.error: must call initscr() first touch_typing_practice/main.py:9: error =========================== short test summary info ============================ FAILED tests/test_main.py::TestMainFunction::test_main_invalid_choice - _curs... =================== 1 failed, 16 passed, 1 skipped in 1.12s ====================
touch_typing_practice/main.py
. ✓
Sandbox logs for https://github.com/wwzeng1/touch_typing_practice/commit/6ff93cc4f58f96f93a2997c336c5b89407800e87
trunk fmt touch_typing_practice/main.py || return 0
1/3 ✓✔ Formatted touch_typing_practice/main.py Re-checking autofixed files... ✔ Formatted touch_typing_practice/main.py Re-checking autofixed files... Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures touch_typing_practice/main.py
2/3 ✓Checked 1 file ✔ No issues
pytest
3/3 ✓============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 16 items tests/test_session.py ..... [ 31%] tests/test_typing_practice.py ...... [ 68%] tests/test_user.py ..... [100%] ============================== 16 passed in 1.09s ==============================
tests/test_main.py
. ✗
Sandbox logs for
trunk fmt tests/test_main.py || return 0
1/1 ❌ (`2`)FAILURES black tests/test_main.py .trunk/out/KHztV.yaml NOTICES A tool failed to run. You can open the details yaml file for more information. Checked 1 file ✖ No issues, 1 failure Run trunk upgrade to upgrade 1 linter bash: line 1: return: can only `return' from a function or sourced script
tests/test_main.py
. ✗
Sandbox logs for
trunk fmt tests/test_main.py || return 0
1/2 ✓✔ Formatted tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures tests/test_main.py
2/2 ❌ (`1`)✔ Auto-fixed tests/test_main.py Re-checking autofixed files... ISSUES tests/test_main.py:58:9 58:9 high Undefined name `mock_curses_initscr` ruff/F821 Checked 1 file ✖ 1 new issue
tests/test_main.py
. ✗
Sandbox logs for
trunk fmt tests/test_main.py || return 0
1/3 ✓✔ Formatted tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures tests/test_main.py
2/3 ✓✔ Auto-fixed tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues
pytest
3/3 ❌ (`1`)============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 18 items tests/test_main.py sF [ 11%] tests/test_session.py ..... [ 38%] tests/test_typing_practice.py ...... [ 72%] tests/test_user.py ..... [100%] =================================== FAILURES =================================== __________________ TestMainFunction.test_main_invalid_choice ___________________ self =mock_TypingPractice = mock_User_load = @patch("touch_typing_practice.main.User.load") @patch("touch_typing_practice.main.TypingPractice") def test_main_invalid_choice(self, mock_TypingPractice, mock_User_load): mock_stdscr = MagicMock() mock_stdscr.getstr.side_effect = [ b"username", b"invalid choice", b"1", b"sample text", b"typed sample text", b"3", ] mock_User_load.return_value = MagicMock() mock_TypingPractice.return_value = create_autospec(TypingPractice) > main(mock_stdscr) tests/test_main.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ touch_typing_practice/main.py:8: in main stdscr = curses.initscr() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def initscr(): import _curses, curses # we call setupterm() here because it raises an error # instead of calling exit() in error cases. > setupterm(term=_os.environ.get("TERM", "unknown"), fd=_sys.__stdout__.fileno()) E _curses.error: setupterm: could not find terminal /usr/lib/python3.10/curses/__init__.py:29: error =========================== short test summary info ============================ FAILED tests/test_main.py::TestMainFunction::test_main_invalid_choice - _curs... =================== 1 failed, 16 passed, 1 skipped in 1.21s ====================
touch_typing_practice/main.py
. ✗
Sandbox logs for
trunk fmt touch_typing_practice/main.py || return 0
1/3 ✓Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures touch_typing_practice/main.py
2/3 ✓Checked 1 file ✔ No issues
pytest
3/3 ❌ (`1`)============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 18 items tests/test_main.py sF [ 11%] tests/test_session.py ..... [ 38%] tests/test_typing_practice.py ...... [ 72%] tests/test_user.py ..... [100%] =================================== FAILURES =================================== __________________ TestMainFunction.test_main_invalid_choice ___________________ self =mock_TypingPractice = mock_User_load = @patch("touch_typing_practice.main.User.load") @patch("touch_typing_practice.main.TypingPractice") def test_main_invalid_choice(self, mock_TypingPractice, mock_User_load): mock_stdscr = MagicMock() mock_stdscr.getstr.side_effect = [ b"username", b"invalid choice", b"1", b"sample text", b"typed sample text", b"3", ] mock_User_load.return_value = MagicMock() mock_TypingPractice.return_value = create_autospec(TypingPractice) > main(mock_stdscr) tests/test_main.py:55: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ stdscr = def main(stdscr): # Clear screen # stdscr = curses.initscr() # Removed as it's not needed with curses.wrapper() stdscr.clear() > curses.echo() E _curses.error: must call initscr() first touch_typing_practice/main.py:12: error =========================== short test summary info ============================ FAILED tests/test_main.py::TestMainFunction::test_main_invalid_choice - _curs... =================== 1 failed, 16 passed, 1 skipped in 1.12s ====================
touch_typing_practice/main.py
. ✗
Sandbox logs for
trunk fmt touch_typing_practice/main.py || return 0
1/3 ✓Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures touch_typing_practice/main.py
2/3 ✓Checked 1 file ✔ No issues
pytest
3/3 ❌ (`1`)============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 18 items tests/test_main.py sF [ 11%] tests/test_session.py ..... [ 38%] tests/test_typing_practice.py ...... [ 72%] tests/test_user.py ..... [100%] =================================== FAILURES =================================== __________________ TestMainFunction.test_main_invalid_choice ___________________ self =mock_TypingPractice = mock_User_load = @patch("touch_typing_practice.main.User.load") @patch("touch_typing_practice.main.TypingPractice") def test_main_invalid_choice(self, mock_TypingPractice, mock_User_load): mock_stdscr = MagicMock() mock_stdscr.getstr.side_effect = [ b"username", b"invalid choice", b"1", b"sample text", b"typed sample text", b"3", ] mock_User_load.return_value = MagicMock() mock_TypingPractice.return_value = create_autospec(TypingPractice) main(mock_stdscr) mock_stdscr.clear.assert_called() mock_User_load.assert_called_with(b"username") mock_TypingPractice.assert_called() mock_TypingPractice.return_value.start_session.assert_called_with( b"sample text" ) mock_TypingPractice.return_value.end_session.assert_called_with( b"typed sample text" ) > mock_TypingPractice.return_value.get_user_statistics.assert_called() tests/test_main.py:66: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def assert_called(self): """assert that the mock was called at least once """ if self.call_count == 0: msg = ("Expected '%s' to have been called." % (self._mock_name or 'mock')) > raise AssertionError(msg) E AssertionError: Expected 'get_user_statistics' to have been called. /usr/lib/python3.10/unittest/mock.py:898: AssertionError ----------------------------- Captured stdout call ----------------------------- Enter your username: 1. Start new session 2. View statistics 3. Exit Invalid choice. Please try again. 1. Start new session 2. View statistics 3. Exit Enter text for the session: Start typing: Session ended. Your progress has been recorded. 1. Start new session 2. View statistics 3. Exit =========================== short test summary info ============================ FAILED tests/test_main.py::TestMainFunction::test_main_invalid_choice - Asser... =================== 1 failed, 16 passed, 1 skipped in 1.17s ====================
tests/test_main.py
. ✗
Sandbox logs for
trunk fmt tests/test_main.py || return 0
1/3 ✓✔ Formatted tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures tests/test_main.py
2/3 ✓✔ Auto-fixed tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues
pytest
3/3 ❌ (`1`)============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 18 items tests/test_main.py sF [ 11%] tests/test_session.py ..... [ 38%] tests/test_typing_practice.py ...... [ 72%] tests/test_user.py ..... [100%] =================================== FAILURES =================================== __________________ TestMainFunction.test_main_invalid_choice ___________________ self =mock_TypingPractice = mock_User_load = @patch("touch_typing_practice.main.User.load") @patch("touch_typing_practice.main.TypingPractice") def test_main_invalid_choice(self, mock_TypingPractice, mock_User_load): mock_stdscr = MagicMock() mock_stdscr.getstr.side_effect = [ b"username", b"invalid choice", b"1", b"sample text", b"typed sample text", b"3", ] mock_User_load.return_value = MagicMock() mock_TypingPractice.return_value = create_autospec(TypingPractice) main(mock_stdscr) mock_stdscr.clear.assert_called() mock_User_load.assert_called_with(b"username") mock_TypingPractice.assert_called() mock_TypingPractice.return_value.start_session.assert_called_with( b"sample text" ) mock_TypingPractice.return_value.end_session.assert_called_with( b"typed sample text" ) > mock_TypingPractice.return_value.get_user_statistics.assert_called() tests/test_main.py:69: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def assert_called(self): """assert that the mock was called at least once """ if self.call_count == 0: msg = ("Expected '%s' to have been called." % (self._mock_name or 'mock')) > raise AssertionError(msg) E AssertionError: Expected 'get_user_statistics' to have been called. /usr/lib/python3.10/unittest/mock.py:898: AssertionError ----------------------------- Captured stdout call ----------------------------- Enter your username: 1. Start new session 2. View statistics 3. Exit Invalid choice. Please try again. 1. Start new session 2. View statistics 3. Exit Enter text for the session: Start typing: Session ended. Your progress has been recorded. 1. Start new session 2. View statistics 3. Exit =========================== short test summary info ============================ FAILED tests/test_main.py::TestMainFunction::test_main_invalid_choice - Asser... =================== 1 failed, 16 passed, 1 skipped in 1.25s ====================
touch_typing_practice/main.py
. ✗
Sandbox logs for
trunk fmt touch_typing_practice/main.py || return 0
1/3 ✓Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures touch_typing_practice/main.py
2/3 ✓Checked 1 file ✔ No issues
pytest
3/3 ❌ (`1`)============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 18 items tests/test_main.py sF [ 11%] tests/test_session.py ..... [ 38%] tests/test_typing_practice.py ...... [ 72%] tests/test_user.py ..... [100%] =================================== FAILURES =================================== __________________ TestMainFunction.test_main_invalid_choice ___________________ self =mock_TypingPractice = mock_User_load = @patch("touch_typing_practice.main.User.load") @patch("touch_typing_practice.main.TypingPractice") def test_main_invalid_choice(self, mock_TypingPractice, mock_User_load): mock_stdscr = MagicMock() mock_stdscr.getstr.side_effect = [ b"username", b"invalid choice", b"1", b"sample text", b"typed sample text", b"3", ] mock_User_load.return_value = MagicMock() mock_TypingPractice.return_value = create_autospec(TypingPractice) main(mock_stdscr) mock_stdscr.clear.assert_called() mock_User_load.assert_called_with(b"username") mock_TypingPractice.assert_called() mock_TypingPractice.return_value.start_session.assert_called_with( b"sample text" ) mock_TypingPractice.return_value.end_session.assert_called_with( b"typed sample text" ) > mock_TypingPractice.return_value.get_user_statistics.assert_called() tests/test_main.py:66: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def assert_called(self): """assert that the mock was called at least once """ if self.call_count == 0: msg = ("Expected '%s' to have been called." % (self._mock_name or 'mock')) > raise AssertionError(msg) E AssertionError: Expected 'get_user_statistics' to have been called. /usr/lib/python3.10/unittest/mock.py:898: AssertionError ----------------------------- Captured stdout call ----------------------------- Enter your username: 1. Start new session 2. View statistics 3. Exit Invalid choice. Please try again. 1. Start new session 2. View statistics 3. Exit Enter text for the session: Start typing: Session ended. Your progress has been recorded. 1. Start new session 2. View statistics 3. Exit =========================== short test summary info ============================ FAILED tests/test_main.py::TestMainFunction::test_main_invalid_choice - Asser... =================== 1 failed, 16 passed, 1 skipped in 1.17s ====================
touch_typing_practice/main.py
. ✗
Sandbox logs for
trunk fmt touch_typing_practice/main.py || return 0
1/3 ✓Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures touch_typing_practice/main.py
2/3 ✓Checked 1 file ✔ No issues
pytest
3/3 ❌ (`1`)============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 18 items tests/test_main.py sF [ 11%] tests/test_session.py ..... [ 38%] tests/test_typing_practice.py ...... [ 72%] tests/test_user.py ..... [100%] =================================== FAILURES =================================== __________________ TestMainFunction.test_main_invalid_choice ___________________ self =mock_TypingPractice = mock_User_load = @patch("touch_typing_practice.main.User.load") @patch("touch_typing_practice.main.TypingPractice") def test_main_invalid_choice(self, mock_TypingPractice, mock_User_load): mock_stdscr = MagicMock() mock_stdscr.getstr.side_effect = [ b"username", b"invalid choice", b"1", b"sample text", b"typed sample text", b"3", ] mock_User_load.return_value = MagicMock() mock_TypingPractice.return_value = create_autospec(TypingPractice) > main(mock_stdscr) tests/test_main.py:55: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ stdscr = def main(stdscr): # Clear screen # stdscr = curses.initscr() # Removed as it's not needed with curses.wrapper() stdscr.clear() > curses.echo() E _curses.error: must call initscr() first touch_typing_practice/main.py:12: error =========================== short test summary info ============================ FAILED tests/test_main.py::TestMainFunction::test_main_invalid_choice - _curs... =================== 1 failed, 16 passed, 1 skipped in 1.12s ====================
tests/test_main.py
. ✗
Sandbox logs for
trunk fmt tests/test_main.py || return 0
1/3 ✓✔ Formatted tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures tests/test_main.py
2/3 ✓✔ Auto-fixed tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues
pytest
3/3 ❌ (`1`)============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 18 items tests/test_main.py sF [ 11%] tests/test_session.py ..... [ 38%] tests/test_typing_practice.py ...... [ 72%] tests/test_user.py ..... [100%] =================================== FAILURES =================================== __________________ TestMainFunction.test_main_invalid_choice ___________________ self =mock_TypingPractice = mock_User_load = @patch("touch_typing_practice.main.User.load") @patch("touch_typing_practice.main.TypingPractice") def test_main_invalid_choice(self, mock_TypingPractice, mock_User_load): mock_stdscr = MagicMock() mock_stdscr.getstr.side_effect = [ b"username", b"invalid choice", b"1", b"sample text", b"typed sample text", b"3", ] mock_User_load.return_value = MagicMock() mock_TypingPractice.return_value = create_autospec(TypingPractice) main(mock_stdscr) > main(mock_stdscr) tests/test_main.py:59: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ touch_typing_practice/main.py:14: in main username = stdscr.getstr(0, 0, 15) /usr/lib/python3.10/unittest/mock.py:1114: in __call__ return self._mock_call(*args, **kwargs) /usr/lib/python3.10/unittest/mock.py:1118: in _mock_call return self._execute_mock_call(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , args = (0, 0, 15) kwargs = {}, effect = def _execute_mock_call(self, /, *args, **kwargs): # separate from _increment_mock_call so that awaited functions are # executed separately from their call, also AsyncMock overrides this method effect = self.side_effect if effect is not None: if _is_exception(effect): raise effect elif not _callable(effect): > result = next(effect) E StopIteration /usr/lib/python3.10/unittest/mock.py:1175: StopIteration ----------------------------- Captured stdout call ----------------------------- Enter your username: 1. Start new session 2. View statistics 3. Exit Invalid choice. Please try again. 1. Start new session 2. View statistics 3. Exit Enter text for the session: Start typing: Session ended. Your progress has been recorded. 1. Start new session 2. View statistics 3. Exit Enter your username: =========================== short test summary info ============================ FAILED tests/test_main.py::TestMainFunction::test_main_invalid_choice - StopI... =================== 1 failed, 16 passed, 1 skipped in 1.24s ====================
[X] Ran sandbox for tests/test_main.py
. ▶
Run `tests/test_main.py` through the sandbox.
[X] Ran sandbox for tests/test_main.py
. ▶
Sandbox logs for
trunk fmt tests/test_main.py || return 0
1/3 ✓✔ Formatted tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures tests/test_main.py
2/3 ✓✔ Auto-fixed tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues
pytest
3/3 ❌ (`1`)============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 18 items tests/test_main.py sF [ 11%] tests/test_session.py ..... [ 38%] tests/test_typing_practice.py ...... [ 72%] tests/test_user.py ..... [100%] =================================== FAILURES =================================== __________________ TestMainFunction.test_main_invalid_choice ___________________ self =mock_TypingPractice = mock_User_load = @patch("touch_typing_practice.main.User.load") @patch("touch_typing_practice.main.TypingPractice") def test_main_invalid_choice(self, mock_TypingPractice, mock_User_load): mock_stdscr = MagicMock() mock_stdscr.getstr.side_effect = [ b"username", b"invalid choice", b"1", b"sample text", b"typed sample text", b"3", ] mock_User_load.return_value = MagicMock() mock_TypingPractice.return_value = create_autospec(TypingPractice) main(mock_stdscr) > main(mock_stdscr) tests/test_main.py:59: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ touch_typing_practice/main.py:14: in main username = stdscr.getstr(0, 0, 15) /usr/lib/python3.10/unittest/mock.py:1114: in __call__ return self._mock_call(*args, **kwargs) /usr/lib/python3.10/unittest/mock.py:1118: in _mock_call return self._execute_mock_call(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , args = (0, 0, 15) kwargs = {}, effect = def _execute_mock_call(self, /, *args, **kwargs): # separate from _increment_mock_call so that awaited functions are # executed separately from their call, also AsyncMock overrides this method effect = self.side_effect if effect is not None: if _is_exception(effect): raise effect elif not _callable(effect): > result = next(effect) E StopIteration /usr/lib/python3.10/unittest/mock.py:1175: StopIteration ----------------------------- Captured stdout call ----------------------------- Enter your username: 1. Start new session 2. View statistics 3. Exit Invalid choice. Please try again. 1. Start new session 2. View statistics 3. Exit Enter text for the session: Start typing: Session ended. Your progress has been recorded. 1. Start new session 2. View statistics 3. Exit Enter your username: =========================== short test summary info ============================ FAILED tests/test_main.py::TestMainFunction::test_main_invalid_choice - StopI... =================== 1 failed, 16 passed, 1 skipped in 1.24s ====================
tests/test_main.py
. ▶
Sandbox logs for
trunk fmt tests/test_main.py || return 0
1/3 ✓✔ Formatted tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures tests/test_main.py
2/3 ✓✔ Auto-fixed tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues
pytest
3/3 ❌ (`1`)============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 18 items tests/test_main.py sF [ 11%] tests/test_session.py ..... [ 38%] tests/test_typing_practice.py ...... [ 72%] tests/test_user.py ..... [100%] =================================== FAILURES =================================== __________________ TestMainFunction.test_main_invalid_choice ___________________ self =mock_TypingPractice = mock_User_load = @patch("touch_typing_practice.main.User.load") @patch("touch_typing_practice.main.TypingPractice") def test_main_invalid_choice(self, mock_TypingPractice, mock_User_load): mock_stdscr = MagicMock() mock_stdscr.getstr.side_effect = [ b"username", b"invalid choice", b"1", b"sample text", b"typed sample text", b"3", ] mock_User_load.return_value = MagicMock() mock_TypingPractice.return_value = create_autospec(TypingPractice) > main(mock_stdscr) tests/test_main.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ touch_typing_practice/main.py:8: in main stdscr = curses.initscr() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def initscr(): import _curses, curses # we call setupterm() here because it raises an error # instead of calling exit() in error cases. > setupterm(term=_os.environ.get("TERM", "unknown"), fd=_sys.__stdout__.fileno()) E _curses.error: setupterm: could not find terminal /usr/lib/python3.10/curses/__init__.py:29: error =========================== short test summary info ============================ FAILED tests/test_main.py::TestMainFunction::test_main_invalid_choice - _curs... =================== 1 failed, 16 passed, 1 skipped in 1.21s ====================
tests/test_main.py
. ▶
Sandbox logs for
trunk fmt tests/test_main.py || return 0
1/2 ✓✔ Formatted tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures tests/test_main.py
2/2 ❌ (`1`)✔ Auto-fixed tests/test_main.py Re-checking autofixed files... ISSUES tests/test_main.py:58:9 58:9 high Undefined name `mock_curses_initscr` ruff/F821 Checked 1 file ✖ 1 new issue
tests/test_main.py
. ▶
Sandbox logs for
trunk fmt tests/test_main.py || return 0
1/1 ❌ (`2`)FAILURES black tests/test_main.py .trunk/out/KHztV.yaml NOTICES A tool failed to run. You can open the details yaml file for more information. Checked 1 file ✖ No issues, 1 failure Run trunk upgrade to upgrade 1 linter bash: line 1: return: can only `return' from a function or sourced script
tests/test_main.py
. ▶
Sandbox logs for
trunk fmt tests/test_main.py || return 0
1/3 ✓✔ Formatted tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues Run trunk upgrade to upgrade 1 linter
trunk check --fix --print-failures tests/test_main.py
2/3 ✓✔ Auto-fixed tests/test_main.py Re-checking autofixed files... Checked 1 file ✔ No issues
pytest
3/3 ❌ (`1`)============================= test session starts ============================== platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 rootdir: /repo collected 18 items tests/test_main.py sF [ 11%] tests/test_session.py ..... [ 38%] tests/test_typing_practice.py ...... [ 72%] tests/test_user.py ..... [100%] =================================== FAILURES =================================== __________________ TestMainFunction.test_main_invalid_choice ___________________ self =mock_TypingPractice = mock_User_load = @patch("touch_typing_practice.main.User.load") @patch("touch_typing_practice.main.TypingPractice") def test_main_invalid_choice(self, mock_TypingPractice, mock_User_load): mock_stdscr = MagicMock() mock_stdscr.getstr.side_effect = [ b"username", b"invalid choice", b"1", b"sample text", b"typed sample text", b"3", ] mock_User_load.return_value = MagicMock() mock_TypingPractice.return_value = create_autospec(TypingPractice) > main(mock_stdscr) tests/test_main.py:55: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ stdscr = def main(stdscr): # Clear screen stdscr.clear() > curses.echo() E _curses.error: must call initscr() first touch_typing_practice/main.py:9: error =========================== short test summary info ============================ FAILED tests/test_main.py::TestMainFunction::test_main_invalid_choice - _curs... =================== 1 failed, 16 passed, 1 skipped in 1.12s ====================
Description
This pull request adds unit tests for the main.py file and test_main.py file.
Summary
Fixes #2.
🎉 Latest improvements to Sweep:
rope
library to refactor Python! Check out Large Language Models are Bad at Refactoring Code. To have Sweep refactor your code, trysweep: Refactor <your_file>.py
!💡 To get Sweep to edit this pull request, you can: