Repository: nanotech-empa/aiida-gaussian (language: python)

Issue:
Move the tests folder to the root directory
The `tests` folder is only used for development. There is no need to keep it together with the package distribution folder. Herein, it is better to keep it in the root folder.


Discussion / hints:

Fix patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 1ebf125..d3e0f45 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -10,7 +10,7 @@ repos:
             exclude: &exclude_files >
                 (?x)^(
                     .*data/|
-                    aiida_gaussian/tests/.*.in$
+                    tests/.*.in$
                 )$
           - id: trailing-whitespace
             exclude: *exclude_files
@@ -62,4 +62,4 @@ repos:
       rev: 0.2.1
       hooks:
           - id: yamlfmt
-            exclude: ^aiida_gaussian/tests/
+            exclude: ^tests/


Test patch:
diff --git a/conftest.py b/conftest.py
deleted file mode 100644
index 6c9d476..0000000
--- a/conftest.py
+++ /dev/null
@@ -1,35 +0,0 @@
-"""pytest fixtures for simplified testing."""
-
-import pytest
-
-pytest_plugins = ["aiida.manage.tests.pytest_fixtures"]
-
-
-@pytest.fixture
-def fixture_localhost(aiida_localhost):
-    """Return a localhost `Computer`."""
-    localhost = aiida_localhost
-    localhost.set_default_mpiprocs_per_machine(1)
-    return localhost
-
-
-@pytest.fixture
-def fixture_code(fixture_localhost):
-    """Return a `Code` instance configured to run calculations of given entry point on localhost `Computer`."""
-
-    def _fixture_code(entry_point_name):
-        from aiida.orm import Code
-
-        return Code(
-            input_plugin_name=entry_point_name,
-            remote_computer_exec=[fixture_localhost, "/bin/true"],
-        )
-
-    return _fixture_code
-
-
-@pytest.fixture(scope="function")
-def gaussian_code(aiida_local_code_factory):
-    """Get a gaussian code."""
-    gaussian_code = aiida_local_code_factory(executable="g09", entry_point="gaussian")
-    return gaussian_code
diff --git a/aiida_gaussian/tests/__init__.py b/tests/__init__.py
similarity index 100%
rename from aiida_gaussian/tests/__init__.py
rename to tests/__init__.py
diff --git a/aiida_gaussian/tests/calculations/test_gaussian.py b/tests/calculations/test_gaussian.py
similarity index 89%
rename from aiida_gaussian/tests/calculations/test_gaussian.py
rename to tests/calculations/test_gaussian.py
index e3645c1..4a33f91 100644
--- a/aiida_gaussian/tests/calculations/test_gaussian.py
+++ b/tests/calculations/test_gaussian.py
@@ -1,18 +1,16 @@
 """Tests for gaussian plugin."""
-import os
 
 from aiida.orm import Dict, StructureData
 from pymatgen.core import Molecule
 
-from aiida_gaussian import tests
 from aiida_gaussian.calculations.gaussian import GaussianCalculation
 
 
-def test_default(fixture_code, generate_calc_job, file_regression):
+def test_default(filepath_tests, fixture_code, generate_calc_job, file_regression):
     """Test a default calculation for :class:`aiida_gaussian.calculations.gaussian.GaussianCalculation`."""
-    geometry_file = os.path.join(tests.TEST_DIR, "data", "ch4.xyz")
+    geometry_file = filepath_tests / "data" / "ch4.xyz"
 
-    structure = StructureData(pymatgen_molecule=Molecule.from_file(geometry_file))
+    structure = StructureData(pymatgen_molecule=Molecule.from_file(str(geometry_file)))
 
     num_cores = 1
     memory_mb = 1000
diff --git a/aiida_gaussian/tests/calculations/test_gaussian/test_default.in b/tests/calculations/test_gaussian/test_default.in
similarity index 100%
rename from aiida_gaussian/tests/calculations/test_gaussian/test_default.in
rename to tests/calculations/test_gaussian/test_default.in
diff --git a/aiida_gaussian/tests/conftest.py b/tests/conftest.py
similarity index 83%
rename from aiida_gaussian/tests/conftest.py
rename to tests/conftest.py
index 6dc400b..9be2552 100644
--- a/aiida_gaussian/tests/conftest.py
+++ b/tests/conftest.py
@@ -11,6 +11,31 @@
 from aiida.orm import CalcJobNode, FolderData
 from aiida.plugins import ParserFactory
 
+pytest_plugins = ["aiida.manage.tests.pytest_fixtures"]
+
+
+@pytest.fixture
+def fixture_localhost(aiida_localhost):
+    """Return a localhost `Computer`."""
+    localhost = aiida_localhost
+    localhost.set_default_mpiprocs_per_machine(1)
+    return localhost
+
+
+@pytest.fixture
+def fixture_code(fixture_localhost):
+    """Return a `Code` instance configured to run calculations of given entry point on localhost `Computer`."""
+
+    def _fixture_code(entry_point_name):
+        from aiida.orm import Code
+
+        return Code(
+            input_plugin_name=entry_point_name,
+            remote_computer_exec=[fixture_localhost, "/bin/true"],
+        )
+
+    return _fixture_code
+
 
 @pytest.fixture
 def filepath_tests() -> pathlib.Path:
diff --git a/aiida_gaussian/tests/data/__init__.py b/tests/data/__init__.py
similarity index 100%
rename from aiida_gaussian/tests/data/__init__.py
rename to tests/data/__init__.py
diff --git a/aiida_gaussian/tests/data/ch4.xyz b/tests/data/ch4.xyz
similarity index 100%
rename from aiida_gaussian/tests/data/ch4.xyz
rename to tests/data/ch4.xyz
diff --git a/aiida_gaussian/tests/parsers/fixtures/base/nan_inf/aiida.out b/tests/parsers/fixtures/base/nan_inf/aiida.out
similarity index 100%
rename from aiida_gaussian/tests/parsers/fixtures/base/nan_inf/aiida.out
rename to tests/parsers/fixtures/base/nan_inf/aiida.out
diff --git a/aiida_gaussian/tests/parsers/test_base.py b/tests/parsers/test_base.py
similarity index 100%
rename from aiida_gaussian/tests/parsers/test_base.py
rename to tests/parsers/test_base.py
diff --git a/aiida_gaussian/tests/parsers/test_base/test_nan_inf.yml b/tests/parsers/test_base/test_nan_inf.yml
similarity index 100%
rename from aiida_gaussian/tests/parsers/test_base/test_nan_inf.yml
rename to tests/parsers/test_base/test_nan_inf.yml