restage 0.7.1__tar.gz → 0.7.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {restage-0.7.1/src/restage.egg-info → restage-0.7.2}/PKG-INFO +1 -1
  2. {restage-0.7.1 → restage-0.7.2}/src/restage/cache.py +9 -1
  3. {restage-0.7.1 → restage-0.7.2}/src/restage/mcpl.py +0 -1
  4. {restage-0.7.1 → restage-0.7.2/src/restage.egg-info}/PKG-INFO +1 -1
  5. {restage-0.7.1 → restage-0.7.2}/test/test_env_vars.py +15 -0
  6. {restage-0.7.1 → restage-0.7.2}/.github/workflows/pip.yml +0 -0
  7. {restage-0.7.1 → restage-0.7.2}/.github/workflows/wheels.yml +0 -0
  8. {restage-0.7.1 → restage-0.7.2}/.gitignore +0 -0
  9. {restage-0.7.1 → restage-0.7.2}/README.md +0 -0
  10. {restage-0.7.1 → restage-0.7.2}/pyproject.toml +0 -0
  11. {restage-0.7.1 → restage-0.7.2}/setup.cfg +0 -0
  12. {restage-0.7.1 → restage-0.7.2}/src/restage/__init__.py +0 -0
  13. {restage-0.7.1 → restage-0.7.2}/src/restage/bifrost_choppers.py +0 -0
  14. {restage-0.7.1 → restage-0.7.2}/src/restage/config/__init__.py +0 -0
  15. {restage-0.7.1 → restage-0.7.2}/src/restage/config/default.yaml +0 -0
  16. {restage-0.7.1 → restage-0.7.2}/src/restage/cspec_choppers.py +0 -0
  17. {restage-0.7.1 → restage-0.7.2}/src/restage/database.py +0 -0
  18. {restage-0.7.1 → restage-0.7.2}/src/restage/emulate.py +0 -0
  19. {restage-0.7.1 → restage-0.7.2}/src/restage/energy.py +0 -0
  20. {restage-0.7.1 → restage-0.7.2}/src/restage/instr.py +0 -0
  21. {restage-0.7.1 → restage-0.7.2}/src/restage/range.py +0 -0
  22. {restage-0.7.1 → restage-0.7.2}/src/restage/run.py +0 -0
  23. {restage-0.7.1 → restage-0.7.2}/src/restage/scan.py +0 -0
  24. {restage-0.7.1 → restage-0.7.2}/src/restage/splitrun.py +0 -0
  25. {restage-0.7.1 → restage-0.7.2}/src/restage/tables.py +0 -0
  26. {restage-0.7.1 → restage-0.7.2}/src/restage.egg-info/SOURCES.txt +0 -0
  27. {restage-0.7.1 → restage-0.7.2}/src/restage.egg-info/dependency_links.txt +0 -0
  28. {restage-0.7.1 → restage-0.7.2}/src/restage.egg-info/entry_points.txt +0 -0
  29. {restage-0.7.1 → restage-0.7.2}/src/restage.egg-info/requires.txt +0 -0
  30. {restage-0.7.1 → restage-0.7.2}/src/restage.egg-info/top_level.txt +0 -0
  31. {restage-0.7.1 → restage-0.7.2}/test/test_cache.py +0 -0
  32. {restage-0.7.1 → restage-0.7.2}/test/test_cache_ro.py +0 -0
  33. {restage-0.7.1 → restage-0.7.2}/test/test_database.py +0 -0
  34. {restage-0.7.1 → restage-0.7.2}/test/test_energy.py +0 -0
  35. {restage-0.7.1 → restage-0.7.2}/test/test_range.py +0 -0
  36. {restage-0.7.1 → restage-0.7.2}/test/test_scan.py +0 -0
  37. {restage-0.7.1 → restage-0.7.2}/test/test_single.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: restage
3
- Version: 0.7.1
3
+ Version: 0.7.2
4
4
  Author-email: Gregory Tucker <gregory.tucker@ess.eu>
5
5
  License: BSD-3-Clause
6
6
  Classifier: License :: OSI Approved :: BSD License
@@ -26,10 +26,18 @@ class FileSystem:
26
26
  path.mkdir(parents=True)
27
27
  db_write = Database(path / named)
28
28
  root = path
29
+
30
+ def exists_not_root(roc):
31
+ roc = Path(roc)
32
+ if not roc.exists() or not (roc / named).exists():
33
+ return False
34
+ return root.resolve() != roc.resolve() if root is not None else True
35
+
29
36
  if config['fixed'].exists() and config['fixed'].get() is not None:
30
- more = [Path(c) for c in config['fixed'].as_str_seq() if Path(c).exists()]
37
+ more = [Path(c) for c in config['fixed'].as_str_seq() if exists_not_root(c)]
31
38
  for m in more:
32
39
  db_fixed.append(Database(m / named, readonly=True))
40
+
33
41
  if db_write is not None and db_write.readonly:
34
42
  raise ValueError("Specified writable database location is readonly")
35
43
  if db_write is None:
@@ -15,7 +15,6 @@ def mcpl_real_filename(filename: Path) -> Path:
15
15
  check = base.with_suffix(ext)
16
16
  if check.exists() and check.is_file():
17
17
  return check
18
- print(f'{base} -> {check} not found')
19
18
  raise FileNotFoundError(f'Could not find MCPL file {filename}')
20
19
 
21
20
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: restage
3
- Version: 0.7.1
3
+ Version: 0.7.2
4
4
  Author-email: Gregory Tucker <gregory.tucker@ess.eu>
5
5
  License: BSD-3-Clause
6
6
  Classifier: License :: OSI Approved :: BSD License
@@ -1,3 +1,4 @@
1
+ import os
1
2
  from unittest import TestCase
2
3
  from unittest.mock import patch
3
4
  from importlib import reload
@@ -40,6 +41,20 @@ class SettingsTests(TestCase):
40
41
  self.assertTrue(config['fixed'].get() is None)
41
42
  self.assertRaises(ConfigTypeError, config['fixed'].as_str_seq)
42
43
 
44
+ def test_missing_database_in_fixed_config(self):
45
+ from tempfile import TemporaryDirectory
46
+ from pathlib import Path
47
+ with TemporaryDirectory() as tmpdir:
48
+ self.assertFalse((Path(tmpdir) / 'database.db').exists())
49
+ with patch.dict(os.environ, {'RESTAGE_FIXED': tmpdir}):
50
+ reload(restage.config)
51
+ from restage.config import config
52
+ self.assertTrue(config['fixed'].exists())
53
+ self.assertEqual(config['fixed'].as_str(), tmpdir)
54
+ from restage.cache import FILESYSTEM
55
+ self.assertEqual(len(FILESYSTEM.db_fixed), 0)
56
+
57
+
43
58
  def test_restage_standard_config(self):
44
59
  from os import environ
45
60
  reload(restage.config)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes