mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	* Allow SPACY_DATA environment variable in website tests
This commit is contained in:
		
							parent
							
								
									a29c8ee23d
								
							
						
					
					
						commit
						ce3e306376
					
				| 
						 | 
					@ -1,11 +1,13 @@
 | 
				
			||||||
from __future__ import unicode_literals
 | 
					from __future__ import unicode_literals
 | 
				
			||||||
import pytest
 | 
					import pytest
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@pytest.fixture(scope='session')
 | 
					@pytest.fixture(scope='session')
 | 
				
			||||||
def nlp():
 | 
					def nlp():
 | 
				
			||||||
    from spacy.en import English
 | 
					    from spacy.en import English, LOCAL_DATA_DIR
 | 
				
			||||||
    return English()
 | 
					    data_dir = os.environ.get('SPACY_DATA', LOCAL_DATA_DIR)
 | 
				
			||||||
 | 
					    return English(data_dir=data_dir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@pytest.fixture()
 | 
					@pytest.fixture()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
from __future__ import unicode_literals
 | 
					from __future__ import unicode_literals
 | 
				
			||||||
import pytest
 | 
					import pytest
 | 
				
			||||||
import spacy
 | 
					import spacy
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@pytest.fixture()
 | 
					@pytest.fixture()
 | 
				
			||||||
| 
						 | 
					@ -9,8 +10,9 @@ def token(doc):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_load_resources_and_process_text():
 | 
					def test_load_resources_and_process_text():
 | 
				
			||||||
    from spacy.en import English
 | 
					    from spacy.en import English, LOCAL_DATA_DIR
 | 
				
			||||||
    nlp = English()
 | 
					    data_dir = os.environ.get('SPACY_DATA', LOCAL_DATA_DIR)
 | 
				
			||||||
 | 
					    nlp = English(data_dir=data_dir)
 | 
				
			||||||
    doc = nlp('Hello, world. Here are two sentences.')
 | 
					    doc = nlp('Hello, world. Here are two sentences.')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user