Skip to content

Commit

Permalink
edit test
Browse files Browse the repository at this point in the history
  • Loading branch information
MMajidi137 committed Oct 12, 2021
1 parent e431233 commit 2da1785
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions pandapower/test/opf/test_pandamodels_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,46 @@

import pytest

julia_installed = []

@pytest.mark.slow
@pytest.mark.skipif(julia_installed == False, reason="requires julia installation")
def test_julia_installation():

try:
from julia.core import UnsupportedPythonError
except AssertionError:
except ImportError:
UnsupportedPythonError = Exception

assert False

try:
from julia import Main
status = True

except (AssertionError, RuntimeError, UnsupportedPythonError) as e:
status = True
except (ImportError, RuntimeError, UnsupportedPythonError) as e:
status = False
print(e)


julia_installed.append(status)


assert status

return status

julia_installed = test_julia_installation()

@pytest.mark.slow
@pytest.mark.skipif(julia_installed == False, reason="requires julia installation")
@pytest.mark.dependency(depends=['test_julia_installation'])
@pytest.mark.skipif(julia_installed == False, reason="requires julia installation")
def test_julia_connection():

try:
import julia
except:
raise AssertionError(
"install pyjulia properlly to run PandaModels.jl")
# raise ImportError(
# "install pyjulia properlly to run PandaModels.jl")
assert False

try:
julia.Julia()
except:
raise AssertionError(
"cannot connect to julia, check pyjulia configuration")
# raise AssertionError(
# "cannot connect to julia, check pyjulia configuration")
assert False


@pytest.mark.slow
Expand Down Expand Up @@ -72,8 +73,8 @@ def test_pandamodels_installation():
Main.using("PandaModels")
print("using PandaModels in its base mode!")
except:
raise AssertionError("cannot use PandaModels in its base mode")

# raise AssertionError("cannot use PandaModels in its base mode")
assert False

@pytest.mark.slow
@pytest.mark.skipif(julia_installed == False, reason="requires julia installation")
Expand Down Expand Up @@ -106,7 +107,8 @@ def test_pandamodels_dev_mode():
Main.using("PandaModels")
print("using PandaModels in its dev mode!")
except:
raise AssertionError("cannot use PandaModels in its base mode")
# raise AssertionError("cannot use PandaModels in its base mode")
assert False

# activate julia base mode
Pkg.activate()
Expand Down

0 comments on commit 2da1785

Please sign in to comment.