| 1 | # You must manually start a tcp-server up on port 8100
|
|---|
| 2 | # before running this test.
|
|---|
| 3 | host='localhost'
|
|---|
| 4 | port=8100
|
|---|
| 5 | import xapian
|
|---|
| 6 | db = xapian.remote_open_writable(host, port)
|
|---|
| 7 | try:
|
|---|
| 8 | db2 = xapian.remote_open_writable(host, port)
|
|---|
| 9 | print "EEEK - opened twice"
|
|---|
| 10 | except xapian.DatabaseLockError, why:
|
|---|
| 11 | print "Good - got '%s' trying to open a second time" % why
|
|---|
| 12 |
|
|---|
| 13 | db = None # should close the connection.
|
|---|
| 14 | db = xapian.remote_open_writable(host, port)
|
|---|
| 15 | print "Good - opened it a second time after closing first"
|
|---|