Fix some paths, use prod settings in Dockerfile
This commit is contained in:
parent
213bdaa365
commit
c6d9e6ebb0
5 changed files with 24 additions and 14 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -53,5 +53,7 @@ jobs:
|
|||
# run test suite
|
||||
#----------------------------------------------
|
||||
- name: Run tests
|
||||
env:
|
||||
DJANGO_SETTINGS_MODULE: mwmbl.settings_dev
|
||||
run: |
|
||||
poetry run pytest
|
||||
poetry run pytest
|
||||
|
|
|
@ -46,8 +46,6 @@ VOLUME ["/data"]
|
|||
|
||||
EXPOSE 5000
|
||||
|
||||
ENV DJANGO_SETTINGS_MODULE=mwmbl.settings_dev
|
||||
ENV DJANGO_SETTINGS_MODULE=mwmbl.settings_prod
|
||||
|
||||
# WORKDIR "/venv/lib/python3.10/site-packages/mwmbl/"
|
||||
# CMD ["/venv/bin/python", "-m", "uvicorn", "app.asgi:application"]
|
||||
CMD ["/venv/bin/mwmbl-tinysearchengine"]
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import pandas as pd
|
||||
from mwmbl import tinysearchengine
|
||||
from mwmbl.tinysearchengine.completer import Completer
|
||||
|
||||
|
||||
def mockCompleterData(mocker, data):
|
||||
testDataFrame = pd.DataFrame(data, columns=['','term','count'])
|
||||
mocker.patch('mwmbl.tinysearchengine.completer.Completer.get_terms',
|
||||
return_value = testDataFrame)
|
||||
|
||||
|
||||
def test_correctCompletions(mocker):
|
||||
# Mock completer with custom data
|
||||
testdata = [
|
||||
|
@ -14,10 +18,11 @@ def test_correctCompletions(mocker):
|
|||
[3, 'buildings', 1]]
|
||||
mockCompleterData(mocker, testdata)
|
||||
|
||||
completer = app.tinysearchengine.completer.Completer()
|
||||
completer = Completer()
|
||||
completion = completer.complete('build')
|
||||
assert ['build', 'builder', 'buildings'] == completion
|
||||
|
||||
|
||||
def test_correctSortOrder(mocker):
|
||||
# Mock completer with custom data
|
||||
testdata = [
|
||||
|
@ -27,10 +32,11 @@ def test_correctSortOrder(mocker):
|
|||
[3, 'buildings', 3]]
|
||||
mockCompleterData(mocker, testdata)
|
||||
|
||||
completer = app.tinysearchengine.completer.Completer()
|
||||
completer = Completer()
|
||||
completion = completer.complete('build')
|
||||
assert ['build', 'buildings', 'builder'] == completion
|
||||
|
||||
|
||||
|
||||
def test_noCompletions(mocker):
|
||||
# Mock completer with custom data
|
||||
testdata = [
|
||||
|
@ -40,10 +46,11 @@ def test_noCompletions(mocker):
|
|||
[3, 'buildings', 1]]
|
||||
mockCompleterData(mocker, testdata)
|
||||
|
||||
completer = app.tinysearchengine.completer.Completer()
|
||||
completer = Completer()
|
||||
completion = completer.complete('test')
|
||||
assert [] == completion
|
||||
|
||||
|
||||
|
||||
def test_singleCompletions(mocker):
|
||||
# Mock completer with custom data
|
||||
testdata = [
|
||||
|
@ -53,10 +60,11 @@ def test_singleCompletions(mocker):
|
|||
[3, 'buildings', 1]]
|
||||
mockCompleterData(mocker, testdata)
|
||||
|
||||
completer = app.tinysearchengine.completer.Completer()
|
||||
completer = Completer()
|
||||
completion = completer.complete('announce')
|
||||
assert ['announce'] == completion
|
||||
|
||||
|
||||
|
||||
def test_idempotencyWithSameScoreCompletions(mocker):
|
||||
# Mock completer with custom data
|
||||
testdata = [
|
||||
|
@ -66,7 +74,7 @@ def test_idempotencyWithSameScoreCompletions(mocker):
|
|||
[3, 'buildings', 1]]
|
||||
mockCompleterData(mocker, testdata)
|
||||
|
||||
completer = app.tinysearchengine.completer.Completer()
|
||||
completer = Completer()
|
||||
for i in range(3):
|
||||
print(f"iteration: {i}")
|
||||
completion = completer.complete('build')
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from mwmbl.tinysearchengine import Document, TinyIndex, _binary_search_fitting_size, astuple, _trim_items_to_page, _get_page_data, _pad_to_page_size
|
||||
from zstandard import ZstdCompressor
|
||||
|
||||
from mwmbl.tinysearchengine.indexer import TinyIndex, Document, _binary_search_fitting_size, astuple, \
|
||||
_trim_items_to_page, _pad_to_page_size, _get_page_data
|
||||
|
||||
|
||||
def test_create_index():
|
||||
num_pages = 10
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from mwmbl.indexer import process_link
|
||||
from mwmbl.indexer.update_urls import process_link
|
||||
|
||||
|
||||
def test_process_link_normal():
|
||||
|
|
Loading…
Reference in a new issue