|  | @@ -0,0 +1,30 @@
 | 
	
		
			
				|  |  | +import pytest
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import osex
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import os
 | 
	
		
			
				|  |  | +import sys
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +def test_new(tmpdir):
 | 
	
		
			
				|  |  | +    os.chdir(tmpdir.strpath)
 | 
	
		
			
				|  |  | +    osex.symlink("source", "link")
 | 
	
		
			
				|  |  | +    assert os.path.lexists("link")
 | 
	
		
			
				|  |  | +    assert os.readlink("link") == "source"
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +def test_absolute(tmpdir):
 | 
	
		
			
				|  |  | +    os.chdir(tmpdir.strpath)
 | 
	
		
			
				|  |  | +    os.makedirs(os.path.join("1", "2"))
 | 
	
		
			
				|  |  | +    link = os.path.join("1", "2", "link")
 | 
	
		
			
				|  |  | +    source = os.path.join(os.getcwd(), "1", "source")
 | 
	
		
			
				|  |  | +    osex.symlink(source, link, relative = False)
 | 
	
		
			
				|  |  | +    assert os.path.lexists(link)
 | 
	
		
			
				|  |  | +    assert os.readlink(link) == source
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +def test_relative(tmpdir):
 | 
	
		
			
				|  |  | +    os.chdir(tmpdir.strpath)
 | 
	
		
			
				|  |  | +    os.makedirs(os.path.join("1", "2"))
 | 
	
		
			
				|  |  | +    link = os.path.join("1", "2", "link")
 | 
	
		
			
				|  |  | +    source = os.path.join(os.getcwd(), "1", "source")
 | 
	
		
			
				|  |  | +    osex.symlink(source, link, relative = True)
 | 
	
		
			
				|  |  | +    assert os.path.lexists(link)
 | 
	
		
			
				|  |  | +    assert os.readlink(link) == "../source"
 |