Skip to content

Commit

Permalink
Add a behaviour test to find out the available dataset
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Raspaud <martin.raspaud@smhi.se>
  • Loading branch information
mraspaud committed Dec 4, 2015
1 parent 95ea9f3 commit cffe961
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
4 changes: 4 additions & 0 deletions mpop/tests/features/feature-load.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ Feature: Simple and intuitive scene loading (sc. 1)
And some items are no available
Then the data is available in a scene object

Scenario: Data is explorable
Given data is available
When user wants to know what data is available
Then available datasets is returned
24 changes: 18 additions & 6 deletions mpop/tests/features/steps/steps-load.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,22 @@ def step_impl(context):
def step_impl(context):
context.scene.load(["M01"])

#@when(u'user wants to know what data is available')
#def step_impl(context):
# raise NotImplementedError(u'STEP: When user wants to know what data is available')
@when(u'user wants to know what data is available')
def step_impl(context):
from mpop.scene import Scene
from datetime import datetime
os.chdir("/tmp/")
scn = Scene(platform_name="Suomi-NPP", sensor="viirs",
start_time=datetime(2015, 3, 11, 11, 20),
end_time=datetime(2015, 3, 11, 11, 26))
from itertools import chain
available = []
for reader in scn.readers.values():
for item in reader.dataset_names:
available.append(item)
context.available_datasets = available

@then(u'available datasets is returned')
def step_impl(context):
assert(len(context.available_datasets) >= 5)

#@then(u'available datasets is returned')
#def step_impl(context):
# raise NotImplementedError(u'STEP: Then available datasets is returned')

0 comments on commit cffe961

Please sign in to comment.