Merge "Remove fallback to time.clock()"
This commit is contained in:
commit
30567b4c75
@ -10,12 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
try:
|
||||
# Python 3.8 : time.clock was deprecated and removed.
|
||||
from time import perf_counter as clock
|
||||
except ImportError:
|
||||
from time import clock
|
||||
|
||||
import time
|
||||
|
||||
from etcd3gw.client import Etcd3Client
|
||||
from etcd3gw.lock import Lock
|
||||
@ -59,7 +54,7 @@ def main():
|
||||
print("Key delete foo-unknown : %r" % result)
|
||||
|
||||
print('>>>> Lock')
|
||||
lock = Lock('xyz-%s' % clock(), ttl=10000, client=client)
|
||||
lock = Lock('xyz-%s' % time.perf_counter(), ttl=10000, client=client)
|
||||
result = lock.acquire()
|
||||
print("acquire : %r" % result)
|
||||
result = lock.refresh()
|
||||
|
@ -33,12 +33,6 @@ from etcd3gw import exceptions
|
||||
from etcd3gw.tests import base
|
||||
from etcd3gw import utils
|
||||
|
||||
try:
|
||||
# Python 3.8 : time.clock was deprecated and removed.
|
||||
from time import perf_counter as clock
|
||||
except ImportError:
|
||||
from time import clock
|
||||
|
||||
|
||||
def _is_etcd3_running():
|
||||
try:
|
||||
@ -413,7 +407,7 @@ class TestEtcd3Gateway(base.TestCase):
|
||||
@unittest.skipUnless(
|
||||
_is_etcd3_running(), "etcd3 is not available")
|
||||
def test_client_locks(self):
|
||||
lock = self.client.lock(id='xyz-%s' % clock(), ttl=60)
|
||||
lock = self.client.lock(id='xyz-%s' % time.perf_counter(), ttl=60)
|
||||
self.assertIsNotNone(lock)
|
||||
|
||||
self.assertTrue(lock.acquire())
|
||||
|
Loading…
Reference in New Issue
Block a user