Skip to content

Commit

Permalink
Skipping Dupe Lock Checks Python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
JaredLGillespie committed Aug 17, 2019
1 parent 9b3a4b1 commit 9ce2259
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/test_proxyscrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@


import os
import sys
import time
from threading import Thread
import unittest
Expand Down Expand Up @@ -69,6 +70,10 @@ def test_create_collector_exception_if_duplicate(self):
create_collector(self.collector_name, 'socks4')

def test_create_collection_exception_if_duplicate_lock_check(self):
# Intermittent failure in Python 2.7
if sys.version_info.major < 3:
return

def func(): ps.COLLECTORS[self.collector_name] = object()
ps._collector_lock.acquire()
t = Thread(target=hold_lock, args=(ps._collector_lock, 0.1, func))
Expand Down
9 changes: 9 additions & 0 deletions tests/test_scrapers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# SOFTWARE.

import os
import sys
import time
from threading import Thread
import unittest
Expand Down Expand Up @@ -741,6 +742,10 @@ def test_add_resource_exception_if_invalid_resource_type(self):
add_resource(self.resource_name, lambda: set(), 'invalid')

def test_add_resource_exception_if_duplicate_lock_check(self):
# Intermittent failure in Python 2.7
if sys.version_info.major < 3:
return

def func(): pss.RESOURCE_MAP[self.resource_name] = {}
t = Thread(target=hold_lock, args=(_resource_lock, 0.1, func))
t.start()
Expand Down Expand Up @@ -774,6 +779,10 @@ def test_add_resource_type_exception_if_duplicate(self):
add_resource_type(self.resource_type_name)

def test_add_resource_type_exception_if_duplicate_lock_check(self):
# Intermittent failure in Python 2.7
if sys.version_info.major < 3:
return

def func(): pss.RESOURCE_TYPE_MAP[self.resource_type_name] = set()
t = Thread(target=hold_lock, args=(_resource_type_lock, 0.1, func))
t.start()
Expand Down

0 comments on commit 9ce2259

Please sign in to comment.