Skip to content

Commit

Permalink
avoid "Can't pickle local object" on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
philipkcl committed Sep 20, 2023
1 parent 54d641d commit 2f90110
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions doajtest/selenium_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ def find_ele_by_css(self, css_selector: str) -> 'WebElement':
def find_eles_by_css(self, css_selector: str) -> 'WebElement':
return find_eles_by_css(self.selenium, css_selector)

def setUp(self):
super().setUp()
# run doaj server in a background process
def _run_doaj_server(self):
try:
app.run_server(host=self.DOAJ_HOST, port=self.DOAJ_PORT)
except Exception as e:
if isinstance(e, ESMappingMissingError):
log.error(f'es index could be removed by TestCase: {str(e)}')
return

# run doaj server in a background process
def _run():
try:
app.run_server(host=self.DOAJ_HOST, port=self.DOAJ_PORT)
except Exception as e:
if isinstance(e, ESMappingMissingError):
log.error(f'es index could be removed by TestCase: {str(e)}')
return
raise e

raise e
def setUp(self):
super().setUp()

self.doaj_process = Process(target=_run, daemon=True)
self.doaj_process = Process(target=self._run_doaj_server, daemon=True)
self.doaj_process.start()

# prepare selenium driver
Expand Down

0 comments on commit 2f90110

Please sign in to comment.