1 import ./make-test-python.nix ({ pkgs, lib, ... }:
4 This test suite replaces the typical pytestCheckHook function in
5 sqlite3-to-mysql due to the need of a running mysql instance.
9 name = "sqlite3-to-mysql";
10 meta.maintainers = with lib.maintainers; [ gador ];
12 nodes.machine = { pkgs, ... }: {
13 environment.systemPackages = with pkgs; [
15 # create one coherent python environment
17 (ps: sqlite3-to-mysql.propagatedBuildInputs ++
19 python3Packages.pytest
20 python3Packages.pytest-mock
21 python3Packages.pytest-timeout
22 python3Packages.factory-boy
23 python3Packages.docker # only needed so import does not fail
29 package = pkgs.mariadb;
31 # from https://github.com/techouse/sqlite3-to-mysql/blob/master/tests/conftest.py
32 # and https://github.com/techouse/sqlite3-to-mysql/blob/master/.github/workflows/test.yml
33 initialScript = pkgs.writeText "mysql-init.sql" ''
34 create database test_db DEFAULT CHARACTER SET utf8mb4;
35 create user tester identified by 'testpass';
36 grant all on test_db.* to tester;
37 create user tester@localhost identified by 'testpass';
38 grant all on test_db.* to tester@localhost;
42 character-set-server = "utf8mb4";
43 collation-server = "utf8mb4_unicode_ci";
51 machine.wait_for_unit("mysql")
54 "sqlite3mysql --version | grep ${pkgs.sqlite3-to-mysql.version}"
57 # invalid_database_name: assert '1045 (28000): Access denied' in "1044 (42000): Access denied [...]
58 # invalid_database_user: does not return non-zero exit for some reason
59 # test_version: has problems importing sqlite3_to_mysql and determining the version
61 "cd ${pkgs.sqlite3-to-mysql.src} \
62 && pytest -v --no-docker -k \"not test_invalid_database_name and not test_invalid_database_user and not test_version\""