Skip to content

Commit

Permalink
self contained tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementJ18 committed Jan 25, 2024
1 parent 551e194 commit 1cff16c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Ruff
on: [push, pull_request]
on: [pull_request]

jobs:
ruff:
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Tests
on: [push, pull_request]

on: [pull_request]
jobs:
build:

Expand All @@ -18,5 +18,5 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Test
run: |
python -m unittest.functional_tests
python -m unittest.memory_tests
python -m unittest tests.functional_tests
python -m unittest tests.memory_tests
12 changes: 4 additions & 8 deletions tests/memory_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@ def getsize(obj):
class MemoryTests(unittest.TestCase):
def test_1(self):
archive = Archive.empty()

with open("test_data/__edain_data.big", "rb") as f:
archive.add_file("test.big", f.read())
archive.add_file("test_file.txt", b"Clement1"*1250000)

in_memory_size = getsize(archive)

archive = LargeArchive.empty("big_big.big")
with open("test_data/__edain_data.big", "rb") as f:
archive.add_file("test.big", f.read())
archive.add_file("test_file.txt", b"Clement1"*1250000)

on_disk_size = getsize(archive)

Expand All @@ -51,8 +48,7 @@ def test_1(self):

def test_2(self):
archive = LargeArchive.empty("big_big.big")
with open("test_data/__edain_data.big", "rb") as f:
archive.add_file("test.big", f.read())
archive.add_file("test_file.txt", b"Clement1"*1250000)

pre_save_size = getsize(archive)

Expand All @@ -64,7 +60,7 @@ def test_2(self):

loaded_size = getsize(archive)

os.remove("test.big")
os.remove("big_big.big")

assert pre_save_size == post_save_size == loaded_size

Expand Down

0 comments on commit 1cff16c

Please sign in to comment.