Django

Code

Ticket #13082 (closed: fixed)

Opened 5 months ago

Last modified 4 months ago

Oracle-specific test_long_string backends regression test has a bug

Reported by: stvsmth Assigned to: nobody
Milestone: 1.2 Component: Database layer (models, ORM)
Version: 1.1 Keywords: regression backends oracle clob nclob
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

In the process of tracking down an Oracle CLOB encoding issue (to be created in another ticket once I get my head around it), I think I've found a bug in the test_long_string regression test. Since this is an Oracle-specific test I am guessing it doesn't get exercised that often.

The test writes a long string to the database then reads it to ensure there are no round-trip encoding issues. The test appears to drop the table before the read happens. You can see this bug by changing the xrange(4000) portion of the test to xrange(40).

======================================================================
ERROR: test_long_string (regressiontests.backends.tests.LongString)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/stvsmth/code/workspaces/django-trunk/tests/regressiontests/backends/tests.py", line 38, in test_long_string
    self.assertEquals(long_str, row[0].read())
DatabaseError: ORA-00942: table or view does not exist

It looks like the read is lazy, so the drop table command needs to happen after the read:

36             row = c.fetchone()
37             c.execute('DROP TABLE ltext')
38             self.assertEquals(long_str, row[0].read())

The attached patch makes this simple change.

----------------------------------------------------------------------
Ran 6 tests in 0.245s

Attachments

test_long_string_fix.diff (0.6 kB) - added by stvsmth on 03/10/10 11:18:25.

Change History

03/10/10 11:18:25 changed by stvsmth

  • attachment test_long_string_fix.diff added.

03/10/10 19:18:24 changed by russellm

  • needs_better_patch changed.
  • component changed from Testing framework to Database layer (models, ORM).
  • needs_tests changed.
  • milestone set to 1.2.
  • needs_docs changed.
  • stage changed from Unreviewed to Accepted.

If this is a regression, it needs to be addressed for 1.2

03/31/10 21:28:11 changed by ramiro

  • summary changed from Backends test_long_string regression test has a bug to Oracle-specific test_long_string backends regression test has a bug.

04/04/10 12:06:13 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

(In [12913]) Fixed #13082 -- Slight modification to an Oracle test to avoid a problem cause by teardown behavior. Thanks to stvsmth for the report and patch.


Add/Change #13082 (Oracle-specific test_long_string backends regression test has a bug)




Change Properties
Action