Chapter 5 FT failing. Cannot delete db.sqlite3

40 views
Skip to first unread message

Kitch

unread,
Mar 14, 2018, 3:37:29 PM3/14/18
to Obey the testing goat! Test-Driven Web Development with Python book
So, the functional test is failing (my understanding at least) because of existant data in the db from previous runs. Specifically, it's when the check_for_row_in_list_table() function is called:

def check_for_row_in_list_table(self, row_text):
table = self.browser.find_element_by_id('id_list_table')
rows = table.find_elements_by_tag_name('tr')
self.assertIn(row_text, [row.text for row in rows])
[...]


def test_can_start_a_list_and_retrieve_it_later(self):

[...]
self
.check_for_row_in_list_table('2:Use peacock feathers to make a fly')
self.check_for_row_in_list_table('1:Buy peacock feathers')



C:\Users\Kitch\Anaconda3\envs\grinb\python.exe C:/Users/Kitch/code/superlists/functional_tests_story.py
F
======================================================================
FAIL: test_can_start_a_list_and_retrieve_it_later (__main__.NewVisitorTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:/Users/Kitch/code/superlists/functional_tests_story.py", line 58, in test_can_start_a_list_and_retrieve_it_later
self.check_for_row_in_list_table('Use peacock feathers to make a fly')
File "C:/Users/Kitch/code/superlists/functional_tests_story.py", line 18, in check_for_row_in_list_table
self.assertIn(row_text, [row.text for row in rows])
AssertionError: 'Use peacock feathers to make a fly' not found in ['1: Buy peacock feathers', '2: asdfsad', '3: Buy peacock feathers', '4: Buy peacock feathers', '5: asdfsad', '6: sadf', '7: Buy peacock feathers', '8: Buy peacock feathers', '9: Buy peacock feathers', '10: Buy peacock feathers', '11: Use peacock feathers to make a fly', '12: Buy peacock feathers', '13: Use peacock feathers to make a fly', '14: Buy peacock feathers', '15: Use peacock feathers to make a fly', '16: Buy peacock feathers', '17: Use peacock feathers to make a fly']

----------------------------------------------------------------------
Ran 1 test in 8.130s

FAILED (failures=1)

Process finished with exit code 1



Thing is, when I go to delete the db (so I can run migrate) I get this:

(C:\Users\Kitch\Anaconda3\envs\grinb) C:\Users\Kitch\code\superlists>rm db.sqlite3
rm: cannot remove 'db.sqlite3': Device or resource busy


It's never not busy. I've closed out of pycharm and tried it, rebooted my pc even and no joy. Anyone have some tips on how to troubleshoot this?

Harry Percival

unread,
Mar 14, 2018, 3:51:52 PM3/14/18
to Kitch, Obey the testing goat! Test-Driven Web Development with Python book
that's weird. could something be restarting the 'runserver' process?  can you delete it if pycharm isn't running?

at a pinch, go to settings.Py and set the database name to eg "db2.sqlite" ...

--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

--
Harry Percival
+44 78877 02511

Kitch

unread,
Mar 14, 2018, 4:01:07 PM3/14/18
to Obey the testing goat! Test-Driven Web Development with Python book
Gad. I wasn't stopping the server. Problem solved.

Thanks for the lightning fast response, Harry! Happy Pi Day!
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-goat-book+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages