Skip to content

Commit

Permalink
Test for Collector and Collection class (#316)
Browse files Browse the repository at this point in the history
* Test for Collector and Collection class

* Removed unneeded classes

* Swap tests over to check Lint

* Swap tests over to check Lint

* Slight change of tests

* Added sleep between tests

* Added comments

* Minor edit to comments
  • Loading branch information
alexglasertpx authored Jan 21, 2025
1 parent f55d595 commit 8bc6f25
Show file tree
Hide file tree
Showing 2 changed files with 387 additions and 8 deletions.
16 changes: 8 additions & 8 deletions digital_land/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def load(self, directory=None):
self.source.load(directory=directory)
self.endpoint.load(directory=directory)

regenerate_resouces = False
regenerate_resources = False

# Try to load log store from csv first
try:
Expand All @@ -368,22 +368,22 @@ def load(self, directory=None):
except FileNotFoundError:
logging.info("No log.csv - building from log items")
self.load_log_items(directory=directory)
regenerate_resouces = True
regenerate_resources = True

# Now try to load resoucres, unless we need to rebuild them anyway
if not regenerate_resouces:
# Now try to load resources, unless we need to rebuild them anyway
if not regenerate_resources:
try:
self.resource.load_csv(directory=directory)
logging.info(
f"Resource loaded from CSV - {len(self.resource.entries)} entries"
)
except FileNotFoundError:
logging.info("No resources.csv - genereating from log.csv")
regenerate_resouces = True
logging.info("No resources.csv - generating from log.csv")
regenerate_resources = True

# Do we need to regenerate resources?
if regenerate_resouces:
logging.info("Generating resouces from log.csv")
if regenerate_resources:
logging.info("Generating resources from log.csv")
self.resource.load(log=self.log, source=self.source, directory=directory)

# attempts to load in old-resources if the file exists, many use cases won't have any
Expand Down
Loading

0 comments on commit 8bc6f25

Please sign in to comment.