File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1414import pytest
1515import re
1616import sys
17+ from pathlib import Path
1718from textwrap import dedent
1819
1920from dockerfile_parse import DockerfileParser
@@ -1521,3 +1522,18 @@ def test_alt_dockerfile_names(self, tmpdir):
15211522
15221523 validate = DockerfileParser (path = tmpdir , dockerfile_filename = "Containerfile" )
15231524 assert validate .baseimage == out .baseimage
1525+
1526+ def test_dockerfile_path_compatibility (self , tmpdir ):
1527+ tmpdir = Path (tmpdir )
1528+ parser = DockerfileParser (path = tmpdir )
1529+ assert str (parser .dockerfile ) == parser .dockerfile_path
1530+ assert parser .dockerfile == tmpdir / "Dockerfile"
1531+
1532+ with (tmpdir / "nothing" ).open ("w+" ) as testfile :
1533+ nullparser = DockerfileParser (fileobj = testfile )
1534+ assert nullparser .dockerfile is None
1535+ assert nullparser .dockerfile_path is None
1536+
1537+ newfile = tmpdir / "nowhere"
1538+ parser .dockerfile_path = str (newfile )
1539+ assert parser .dockerfile == newfile
You can’t perform that action at this time.
0 commit comments