Skip to content

Commit

Permalink
test: Enable running test from other working directories
Browse files Browse the repository at this point in the history
  • Loading branch information
coroa committed Dec 1, 2017
1 parent a6a40cf commit 7e8d759
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
7 changes: 3 additions & 4 deletions test/test_ac_dc_lopf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@

def test_lopf():

csv_folder_name = os.path.join(os.path.dirname(__file__), "../examples/ac-dc-meshed/ac-dc-data")

csv_folder_name = "../examples/ac-dc-meshed/ac-dc-data"

network = pypsa.Network(csv_folder_name=csv_folder_name)
network = pypsa.Network(csv_folder_name)

results_folder_name = os.path.join(csv_folder_name,"results-lopf")

network_r = pypsa.Network(csv_folder_name=results_folder_name)
network_r = pypsa.Network(results_folder_name)


#test results were generated with GLPK; solution should be unique,
Expand Down
10 changes: 4 additions & 6 deletions test/test_ac_dc_lpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@


def test_lpf():
csv_folder_name = os.path.join(os.path.dirname(__file__), "../examples/ac-dc-meshed/ac-dc-data")

network = pypsa.Network(csv_folder_name)

csv_folder_name = "../examples/ac-dc-meshed/ac-dc-data"
results_folder_name = os.path.join(csv_folder_name, "results-lpf")

network = pypsa.Network(csv_folder_name=csv_folder_name)

results_folder_name = os.path.join(csv_folder_name,"results-lpf")

network_r = pypsa.Network(csv_folder_name=results_folder_name)
network_r = pypsa.Network(results_folder_name)

for snapshot in network.snapshots[:2]:
network.lpf(snapshot)
Expand Down
4 changes: 2 additions & 2 deletions test/test_opf_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
def test_opf():


csv_folder_name = "../examples/opf-storage-hvdc/opf-storage-data"
csv_folder_name = os.path.join(os.path.dirname(__file__), "../examples/opf-storage-hvdc/opf-storage-data")

network = pypsa.Network(csv_folder_name=csv_folder_name)
network = pypsa.Network(csv_folder_name)

#test results were generated with GLPK and other solvers may differ
solver_name = "glpk"
Expand Down
11 changes: 4 additions & 7 deletions test/test_sclopf_scigrid.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
from __future__ import print_function, division
from __future__ import absolute_import

import pypsa

import os
import numpy as np

import pypsa

def test_sclopf():
csv_folder_name = os.path.join(os.path.dirname(__file__), "../examples/scigrid-de/scigrid-with-load-gen-trafos/")


csv_folder_name = "../examples/scigrid-de/scigrid-with-load-gen-trafos/"

network = pypsa.Network(csv_folder_name=csv_folder_name)
network = pypsa.Network(csv_folder_name)

#test results were generated with GLPK and other solvers may differ
solver_name = "cbc"
Expand Down

0 comments on commit 7e8d759

Please sign in to comment.