File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import pytest
22import os
33import sparkhpc
4+ import sys
5+
6+ if sys .version_info .major == 2 :
7+ fnfe = (OSError , IOError )
8+ elif sys .version_info .major == 3 :
9+ fnfe = FileNotFoundError
410
511def find_bindir ():
612 for root , subdirs , files in os .walk ('.' ):
@@ -17,6 +23,8 @@ def find_bindir():
1723INFO:sparkhpc.sparkjob:[start_cluster] master running at spark://1.1.1.1:7077
1824INFO:sparkhpc.sparkjob:[start_cluster] master UI available at http://1.1.1.1:8080"""
1925
26+
27+
2028@pytest .fixture (autouse = True )
2129def change_homedir (monkeypatch ):
2230 monkeypatch .setattr (os .path , 'expanduser' , lambda user : testdir )
@@ -44,7 +52,7 @@ def sj(monkeypatch, request):
4452
4553 try :
4654 os .remove (os .path .join (testdir ,'.sparkhpc1' ))
47- except FileNotFoundError :
55+ except fnfe :
4856 pass
4957
5058def test_job_submission (sj ):
@@ -98,7 +106,7 @@ def test_jobid_start(sj):
98106 assert (sj .master_ui ()) == 'http://1.1.1.1:8080'
99107
100108 # this should fail
101- with pytest .raises (FileNotFoundError ):
109+ with pytest .raises (fnfe ):
102110 sj2 = sj .__class__ (jobid = 100 )
103111
104112
You can’t perform that action at this time.
0 commit comments