Skip to content

Commit

Permalink
Merge pull request #8 from umd-fire-coml/Preprocessor-Read-images
Browse files Browse the repository at this point in the history
Merge Preprocessor read images
  • Loading branch information
syKevinPeng authored Sep 29, 2021
2 parents b7189f1 + eca76d2 commit a86ded0
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/run_all_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: run_all_tests

on: [push, pull_request, workflow_dispatch]

jobs:
RunAllTests:
runs-on: ubuntu-latest
container: python
steps:
- uses: actions/checkout@v2
- name: run_all_tests
run: |
pip install -r requirements.txt
pip install -r test-requirements.txt
python -m pytest
Empty file.
Empty file added getAllImagesFolder/test1.txt
Empty file.
Binary file added requirements.txt
Binary file not shown.
12 changes: 12 additions & 0 deletions src/getAllImagesFunction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os



def getAllImages(imageFolder):
images = []

for path, subdirs, files in os.walk(imageFolder):
for name in files:
images.append(os.path.join(path,name))

return images
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
30 changes: 30 additions & 0 deletions test/test_Get_All_Images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os
import test
import pathlib
import sys
sys.path.insert(0, './src')

from getAllImagesFunction import getAllImages


def test_images():

imageFolder = r"/getAllImagesFolder" #folder with all the images

imageFolderPath = os.getcwd()+ imageFolder
imageFolderPath.encode('unicode_escape')

print (imageFolderPath)

images = getAllImages(imageFolderPath)

imagesRel = []

for image in images:
image = os.path.relpath(image, imageFolderPath)
imagesRel.append(image)


print(len(imagesRel))
assert len(imagesRel) == 2

23 changes: 23 additions & 0 deletions testGetAllImages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from src.getAllImagesFunction import *
import os


imageFolder = "\getAllImagesFolder" #folder with all the images

imageFolderPath = os.getcwd()+ imageFolder
imageFolderPath.encode('unicode_escape')

print (imageFolderPath)

images = getAllImages(imageFolderPath)

imagesRel = []

for image in images:
image = os.path.relpath(image, imageFolderPath)
imagesRel.append(image)




print(imagesRel)

0 comments on commit a86ded0

Please sign in to comment.