| | 74 | ############################################### |
|---|
| | 75 | # Test for ticket #4371 -- fixture loading fails silently in testcases |
|---|
| | 76 | # Validate that error conditions are caught correctly |
|---|
| | 77 | |
|---|
| | 78 | # redirect stderr for the next few tests... |
|---|
| | 79 | >>> import sys |
|---|
| | 80 | >>> savestderr = sys.stderr |
|---|
| | 81 | >>> sys.stderr = sys.stdout |
|---|
| | 82 | |
|---|
| | 83 | # Loading data of an unknown format should fail |
|---|
| | 84 | >>> management.call_command('loaddata', 'bad_fixture1.unkn', verbosity=0) |
|---|
| | 85 | Problem installing fixture 'bad_fixture1': unkn is not a known serialization format. |
|---|
| | 86 | |
|---|
| | 87 | # Loading a fixture file with invalid data using explicit filename |
|---|
| | 88 | >>> management.call_command('loaddata', 'bad_fixture2.xml', verbosity=0) |
|---|
| | 89 | No fixture data found for 'bad_fixture2'. (File format may be invalid.) |
|---|
| | 90 | |
|---|
| | 91 | # Loading a fixture file with invalid data without file extension |
|---|
| | 92 | >>> management.call_command('loaddata', 'bad_fixture2', verbosity=0) |
|---|
| | 93 | No fixture data found for 'bad_fixture2'. (File format may be invalid.) |
|---|
| | 94 | |
|---|
| | 95 | >>> sys.stderr = savestderr |
|---|
| | 96 | |
|---|