Skip to content

Commit f5c5c7a

Browse files
Merge pull request #17 from Nebucatnetzer/flake-parts
Replace devenv with flake-parts and service-flakes
2 parents 4c7084d + 94e9c0e commit f5c5c7a

File tree

14 files changed

+243
-1894
lines changed

14 files changed

+243
-1894
lines changed

.envrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
watch_file poetry.lock
22

3-
if ! use flake . --no-pure-eval; then
3+
if ! use flake; then
44
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
55
fi
66

.github/workflows/build_containers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v4.1.1
11-
- uses: cachix/install-nix-action@v26
12-
- uses: DeterminateSystems/magic-nix-cache-action@main
11+
- uses: wimpysworld/nothing-but-nix@main
12+
- uses: cachix/install-nix-action@v31.3.0
1313
- name: Build snapbin image
1414
run: nix build .#snapbin-image && docker load < ./result
1515

.github/workflows/tests.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4.1.1
14-
- uses: cachix/install-nix-action@v26
15-
- uses: DeterminateSystems/magic-nix-cache-action@main
14+
- uses: wimpysworld/nothing-but-nix@main
15+
- uses: cachix/install-nix-action@v31.3.0
1616
- name: Tests
17-
run: nix develop --impure --command pytest --cov=snapbin tests.py
17+
run: nix develop --command pytest --cov=snapbin tests.py
1818

1919
pylint:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v4.1.1
23-
- uses: cachix/install-nix-action@v26
24-
- uses: DeterminateSystems/magic-nix-cache-action@main
23+
- uses: wimpysworld/nothing-but-nix@main
24+
- uses: cachix/install-nix-action@v31.3.0
2525
- name: Tests
26-
run: nix develop --impure --command pylint snapbin
26+
run: nix develop --command pylint snapbin
2727

2828
mypy:
2929
runs-on: ubuntu-latest
3030
steps:
3131
- uses: actions/checkout@v4.1.1
32-
- uses: cachix/install-nix-action@v26
33-
- uses: DeterminateSystems/magic-nix-cache-action@main
32+
- uses: wimpysworld/nothing-but-nix@main
33+
- uses: cachix/install-nix-action@v31.3.0
3434
- name: Tests
35-
run: nix develop --impure --command mypy .
35+
run: nix develop --command mypy .

conftest.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
import os
2+
from typing import Generator
3+
24
import pytest
5+
from flask.testing import FlaskClient
6+
from peewee import SqliteDatabase
7+
from py.path import local # type: ignore
38

49
os.environ["SNAPBIN_TESTING"] = "true"
510
# pylint: disable=wrong-import-position
11+
from snapbin import database
612
from snapbin import main
713
from snapbin.models.secret import Secret
814

915

1016
@pytest.fixture(scope="function")
11-
def memory_db():
12-
main.db.init(":memory:")
13-
main.db.connect()
14-
main.db.create_tables([Secret])
15-
yield main.db
16-
main.db.close()
17+
def memory_db() -> Generator[SqliteDatabase, None, None]:
18+
database.db.init(":memory:")
19+
database.db.connect()
20+
database.db.create_tables([Secret])
21+
yield database.db
22+
database.db.close()
1723

1824

1925
@pytest.fixture()
20-
def app(tmpdir):
26+
def app(tmpdir: local) -> FlaskClient:
2127
temp_directory = tmpdir.mkdir("db")
2228
main.initialize_db(db_path=f"{temp_directory}/test.db")
2329
main.app.config["TESTING"] = True

docker-compose.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)